Posts Tagged ‘JavaPuzzlers’
[DevoxxUS2017] Java Puzzlers NG S02: Down the Rabbit Hole by Baruch Sadogursky and Viktor Gamov
At DevoxxUS2017, Baruch Sadogursky and Viktor Gamov, from JFrog and Hazelcast respectively, entertained attendees with a lively exploration of Java 8 and 9 puzzlers. Known for their engaging style, Baruch, a Developer Advocate, and Viktor, a Senior Solution Architect, presented complex coding challenges involving streams, lambdas, and Optionals. Their session combined humor, technical depth, and audience interaction, offering valuable lessons for Java developers. This post examines the key themes of their presentation, highlighting strategies to navigate Java’s intricacies.
Decoding Java 8 Complexities
Baruch Sadogursky and Viktor Gamov kicked off with a series of Java 8 puzzlers, focusing on streams and lambdas. They presented scenarios where seemingly simple code led to unexpected outcomes, such as subtle bugs in stream operations. Baruch emphasized the importance of understanding functional programming nuances, using examples to illustrate common pitfalls. Their interactive approach, with audience participation, made complex concepts accessible and engaging.
Navigating Java 9 Features
Transitioning to Java 9, Viktor explored new puzzlers involving modules and CompletableFutures, highlighting how these features introduce fresh challenges. He demonstrated how the module system can lead to compilation errors if misconfigured, urging developers to read documentation carefully. Their examples, drawn from real-world experiences at JFrog and Hazelcast, underscored the need for precision in adopting Java’s evolving features.
Tools for Avoiding Pitfalls
Baruch and Viktor stressed the role of tools like IntelliJ IDEA in catching errors early, noting how its inspections highlight potential issues in lambda and stream usage. They advised against overusing complex constructs, advocating for simplicity to avoid “WTF” moments. Their practical tips, grounded in their extensive conference-speaking experience, encouraged developers to leverage IDEs and documentation to write robust code.
Community Engagement and Resources
Concluding with a call to action, Baruch and Viktor invited developers to contribute puzzlers to JFrog’s puzzlers initiative, fostering community-driven learning. They shared resources, including their slide deck and blog posts, encouraging feedback via Twitter. Their enthusiasm for Java’s challenges inspired attendees to dive deeper into the language’s intricacies, embracing both its power and pitfalls.
Links:
[DevoxxBE2013] The Unpuzzling Kotlin: Bringing Clarity to Your Code
Svetlana Isakova and Aleksei Sedunov, core Kotlin developers at JetBrains, dissect Java’s perplexing behaviors through Kotlin’s lens, affirming its mission for safer, concise JVM code. Svetlana, a language architect and Scala educator, pairs with Aleksei, IDE tooling specialist and Kotlin In-Depth author, to translate infamous Java Puzzlers—exposing casting pitfalls, expression ambiguities, and exception quirks—into Kotlin equivalents that eliminate obscurity.
Kotlin, they assert, rectifies Java’s design flaws via smart casts, safe calls, and extension functions, fostering intuitive industrial programming. Their analysis, rooted in real-world fixes, invites scrutiny at JetBrains’ booth.
Expressions and Control Structures
Svetlana contrasts Java’s operator precedence puzzles with Kotlin’s explicit parentheses, averting silent errors. She demos a chained assignment mishap, resolved in Kotlin by immutable vals.
Aleksei explores null safety: Kotlin’s ?. safe calls and !! assertions prevent NPEs, unlike Java’s unchecked casts.
Exception Handling and Resource Management
Java’s checked exceptions burden APIs, Aleksei notes; Kotlin’s unchecked model simplifies signatures. He illustrates try-with-resources emulation via use extensions, ensuring cleanup.
Svetlana highlights Elvis operator (?:) for concise defaults, streamlining null propagation absent in Java.
Objects, Classes, and Nullability
Kotlin’s data classes auto-generate equals/hashCode, eclipsing Java’s boilerplate. Aleksei demos sealed classes for exhaustive when branches, enhancing pattern matching.
Svetlana unveils nullable types: platform types from Java interop demand explicit handling, with smart casts post-checks yielding type safety.
Extensions and Practical Wisdom
Extensions augment classes without inheritance, Aleksei shows, adding string utilities seamlessly. He addresses puzzler avoidance: Kotlin’s design sidesteps most Java gotchas, though vigilance persists.
Svetlana fields queries on closures and extensions, affirming Kotlin’s simplicity for Java migrants.