It’s exhausting staying up to date with the evolution of Java and the myriad other JVM languages. Is it worth it? What do modern languages give us?
Many JVM languages promote “less boilerplate code” as one of their selling points. Even updates to Java in recent years have removed unnecessary syntax. While this is clearly meant to be a Good Thing, many of us - particularly if we’ve been writing Java for a long time - think “so what?”. Our IDEs can generate code, and our brains get used to ignoring the stuff that doesn’t matter.
Is the removal of extraneous code from the syntax of a language necessary, or just a gimmick? How does it impact our ability to write and read code?
In this talk, Trisha will explore common coding scenarios using Java and Kotlin. We’ll see what a language designed for developer productivity looks like: what’s important for developers to write (and, more importantly, read) and what can be removed. We’ll also see how Java has evolved to improve our productivity as producers and consumers of code, and why staying up to date with the features of a language like Java can ultimately make your life easier.
The code examples from this talk are shamelessly reused from Hadi Hariri’s London Software Craftsmanship Conference talk, The Importance of Syntax In Clean Code.
The code lives here.
- QCon London
- Java™ SE Runtime Environment 18.3 (build 10+45)
- Kotlin: 1.2.21
- IDE: IntelliJ IDEA 2018.1 EAP (Ultimate Edition) Build #IU-181.3986.9
- Java 5: Generics
- Java 7: Diamond operator
- Java 8: Optional
- Java 8: Streams
- Java 8: IntStream
- Java 8: Lambda Expressions
- Java 9: More methods on Optional
- Java 9: Convenience Factory Methods for Collections
- Java 10: Local-variable type inference
- JDK 10 early access releases
- Java 10 Open JDK page (tracks which features are currently going into Java 10)
- Java 11 Open JDK page
- Java??: JEP 302: Lambda Leftovers (including underscore for param)
- Java??: JEP 305: Pattern Matching
- Java??: JEP 325: Switch expressions
- Java??: Data Classes for Java and Brian Goetz on Data Classes for Java
- Data Classes
- Lambdas and higher order functions
- Properties (var/val)
- Equality (== vs ===)
- Type Checks and Casts
- Null Safety
- Default arguments