My first experience with Java came in my second computer science class, Fundamentals of CS. The intro to programming course used C++, and was my first programming outside of BASIC. With the intro course, I learned loops and logic, variables and function declaration, memory allocation, and basic objects and classes.
After that, the CS department at CMU decided to switch to this brand new programming language, Java. It ran on any platform, which was great because the primary CS clusters were Solaris machines (a Unix variant put out by Sun). This was back before everyone had a Mac laptop that was also a Linux box. But it introduced me to a whole mess of other language features: threads, garbage collection, AWT (the abstract windows toolkit), exceptions, and object oriented programming.
Since then, Java has gone through roughly fourteen major feature releases,, transitioned between stewards with Oracle’s purchase of Sun Microsystems, open sourced the code behind the language, and spawned several languages that use its virtual machine, including Scala, Clojure, and Kotlin. Personally, I’ve worked for several companies that built complex products on Java, whether they were embedded in browsers, installed in desktops through WebStart, or behind the scenes in a service-oriented architecture backend.
1995 to 2020—that quarter century is saw the rise and fall of several epochs in the tech industry. I asked Georges Saab, Vice President of Software Development at Oracle’s Java Platform Group what changes to Java made the most impact and what upcoming features he believes will have a real affect on its future. Here’s some of the features that Saab feels made the language proliferate and a few that will keep it enduring.
High impact changes
The very first feature that made a massive impact wasn’t a change in the Java language at all. It was the vastly improved library support that happened in the early releases. Between 1.0 and 1.3, these libraries included the Swing window toolkit, the Collections framework, a RPC-like API for remote calls, JDBC for interacting with databases, and more. The standard libraries grew richer, more sophisticated, and allowed Java to become a real enterprise language.
In 2004, Java added generics, which allowed types, methods, and interfaces to be specified with the associated data types to be specified when that item was instantiated without sacrificing type safety. “At the time, generics were a challenge and people had strong opinions about them,” said Saab. Today, generics are one of the enduring features of the language.
Java may have been designed as a completely object oriented language, but when Java SE 8 was released in 2014, it added Lambda expressions (aka closures), which added some functional programming elements. Not every problem is best served by OOP, and by adding Lambdas, Java became more flexible.
Java 9 addressed the potential dependency issues that a pile of JAR files could lead to with modules. It allowed library code to be encapsulated so that when you import a package, you only import the module you need, not the whole JAR. Any dependencies that module has are explicitly declared, so you can check the code to see what code you’re importing. “Having them know that they're not inadvertently depending on something is leading us to a point where the Java ecosystem is much more resilient towards change and constant evolution,” said Saab.
The bonus feature improvement is one that regular users may not have noticed: the performance of the JVM has been constantly improving. “You don't necessarily see it happening, but what you see is the effect,” said Saab. “Code that I wrote that ran on J2SE 1.3 still runs on Java 14, but it's just much, much faster. Not only is it faster, but it's faster in a way takes advantage of changes in hardware that nobody had any idea were going to happen in 2004.”
What Java is brewing for the future
Despite its prominence across numerous industries, Java isn’t sitting still. Saab mentioned four big projects coming to Java that had him excited, all designated by codenames: Loom, Valhalla, Leyden, and ZGC.
The Loom project aims to loosen the coupling between Java threads and native threads. Java has had concurrency via threads from the beginning, but they were always tied to an OS thread. Loom introduces fibers, JVM-managed threads that allow more efficient concurrency. With Java server-side applications handling the load of thousands of simultaneous users, better concurrency can only improve web performance.
Valhalla aims to revise the memory model for Java to allow for immutable types, which are more complex than primitives, but less flexible than objects. Sometimes you have more complex data that doesn’t change over the course of that object’s lifespan; burdening it with the overhead of a class is unnecessary. The initial proposal put it more succinctly: “Codes like a class, works like an int.” “For things like big data for machine learning or for natural language, Valhalla promises to represent data in a way that allows the JVM to fully take advantage of modern hardware architectures that have changed dramatically since Java was created,” said Saab.
Leyden aims to address the startup time of Java applications. For monoliths and single applications, Java sometimes took a while to get going, but once up and running, they were fast. “That’s great if your app server is going to run for two weeks or two months or two years, but it's not that great if you want to run for 30 milliseconds,” said Saab. Server-side software is getting smaller and more distributed, so quick starts are key to fast response times.
ZGC is a new garbage collector that can handle massive heap sizes, up to 16 terabytes in size, without an increase in pause time. For big data applications that may be processing massive amounts of data in-memory, keeping garbage collection pauses down below 10ms means that processing speed on large data sets won’t be stalled out by limitations in the language.
Java has grown to be integral to much of the modern internet and mobile app landscape, and promises to continue to be part of the information technology toolkit for some time in the future. A quarter century is an eternity in programming, so raise a `class` to Java, past, present, and future.
If you want to learn more, Oracle has put together a wealth of resources to celebrate Java's 25th anniversary. If you want to check out part 1 of this series, you can find it here.
A written transcript of this podcast is available here.