Java has undergone considerable change in the past few years to add features that make it more versatile when compared with other JVM based languages. It still has challenges but its flexible style makes it more inclusive to programmers with different abilities. Hence, it remains the most widely used programming language.
Discussing this with other speakers at the JVM Wars organised by Orbis Consultants last week was illuminating. Key takeaways,
1. Frameworks are not the language. If a certain framework makes a language restrictive or unusable, its not the fault of the language. Choose a better framework or work without frameworks.
2. Choose languages and frameworks that help solve business problems intuitively.
3. Be more inclusive with the choice and use of languages, frameworks and tools.
2. Background
Language From Used Last Used For
C 1995 2006 Dedicated/
Embedded Apps
Java 1996 Current Enterprise Apps
C++ 1998 2012 Dedicated/
Enterprise Apps
C# 2008 2015 Enterprise Apps
Scala 2012 2017 Enterprise Apps
3. Initial Adoption
● Mandated by BT for their University Research
Initiative (URI) in 1996 as a PoC.
● C-style but safer than both C and C++.
● Simpler than C++.
● WORA (Write Once Run Anywhere).
4. Continued Appeal
● Simple and intuitive concepts.
● Extensive tool support.
● A large and growing ecosystem.
● A wide talent pool globally.
5. Criticisms
● Verbosity
– Too much text leading to developer fatigue.
● Footprint
– Heavyweight class library.
● Elegance
– Largely imperative code.
● Syntactic sugar
– Generic erasures.
6. Criticisms
● Uniformity
– Primitives vs. wrapper classes.
– Autoboxing.
● Exceptions
– Checked and unchecked.
● Frameworkitis
– The disease that a framework wants to do too much
for you or it does it in a way that you don't want but
you can't change it.
7. Optimism - Elegance
● Functional programming since Java 8.
– Lambda expressions.
– Stream API.
● Collections factory methods since Java 9.
– Set<Integer> ints = Set.of(1, 2, 3);
● Additional Stream API methods in Java 9.
– dropWhile, takeWhile, iterate, ofNullable.
● Enhancements in String API all along.
8. Optimism - Verbosity
● Local variable type inferencing from Java 10.
– Optimises over diamond operator.
● var list = new ArrayList<String>();
● Switch statement improvements from Java 12.
– Converted to expressions returning values.
– Breaks removed.
– Multiple options serialised on a single line.
● Text blocks from Java 13.
– Complex multi-line text can be specified between
triple quotes (“””).
10. Optimism - Modularity
● Project Jigsaw – Java 9
– Create a module system for the language.
– Apply it to the JDK source.
– Modularize the JDK libraries.
– Update the runtime to support modularity.
– Create smaller runtime with a subset of JDK modules.
● Stronger encapsulation at jar level.
– Better control of service granularity.
11. Selecting Java for a Project
● Technology unification programme initiated in
2015.
– Kotlin v1.0 released in early 2016 limiting choice
between Java and Scala.
● Talent – key reason for choosing Java.
– 90 developers in 4 global location.
● Microservices architecture.
– Choosing an appropriate language for the service.
– Emerging Java features made it a strong contender.
13. A Tale of Reversion – Early 2016
● A Scala based microservices application.
● Challenges,
– Long cycle time to implement idiomatic Scala code.
– Steeper learning curve.
– Small, fluid talent pool.
● Piloted Java 8 with existing team,
– Positive overall developer experience.