Java 9: “Project Jigsaw is finally giving us a badly needed Java seatbelt”
Oracle recently announced the general availability of Java SE 9 — even though it has over 150 new features to offer, the star of the release is the Java Platform Module System, also known as Project Jigsaw. We talked with Marcus Biel, CleanCode Evangelist and JCP member about his favorite features in Java 9, the ones that were not included, Project Jigsaw and the new version numbering scheme.
Java 9 is finally here. It has over 150 new features to offer, including a new module system and quite a few improvements which promise to bring boosted security, more scalability and better performance management.
The star of the release is, of course, the Java Platform Module System, also known as Project Jigsaw. Its goal is to help developers to reliably assemble and maintain sophisticated applications. Furthermore, developers can bundle only the parts of the JDK that are needed to run an application when deploying to the cloud so one could say that the module system also makes the JDK itself more flexible.
If you don’t want to dive into the modular ecosystem right away, you should know that it is possible to get started on JDK 9 without modules. As Georges Saab, vice president of development for the Java Platform Group at Oracle told us a few months ago, “the class path continues to work, and this is how many developers will likely get started with JDK 9.”
We talked with Marcus Biel, CleanCode Evangelist and JCP member about his favorite features in Java 9, the ones that were not included, Project Jigsaw and the new version numbering scheme.
JAXenter: The wait is over — Java 9 has been released. What is your favorite feature and why?
Marcus Biel: I think the jshell is pretty cool, although I wouldn’t call it my favorite feature. If I really want to figure out how a class or method works, I prefer to experiment directly with the code. Unlike documentation, code never lies. Also, programming is best learned by programming. The jshell is the ideal solution for this. I’ve always been annoyed by the overhead necessary to “briefly” run a few lines of code. With the jshell it’s so much simpler now — people should go try it for themselves right now!
Programming is best learned by programming. The jshell is the ideal solution for this.
JAXenter: Are there features you would have liked to see in Java 9 but were not included?
Marcus Biel: I’d prefer them to fix some bad decisions that were made in the past than add even more new features. Java is over 20 years old now so some cleanup wouldn’t hurt. At the @JcreteUnconf, I attended a session where we collected a few ideas of what we thought should be removed or adjusted.
- Checked Exceptions
- Primitive Types
- Vector and Hashtable
- Null References
JAXenter: Project Jigsaw is finally here. How do you feel about the modular system? Will you get started with or without modules?
Marcus Biel: Jigsaw’s modular approach is a big step in the right direction. But the migration to a modular system will hurt at first. It isn’t easy to properly modularize a bigger project and that will cost a lot of time. I’m currently working for a client who is switching to Java 8 for the first time, so Jigsaw will have to wait a little bit!
JAXenter: Project Jigsaw should have been a major feature of Java 8 but Oracle decided to postpone it. Instead, it became the key feature of Java 9 — was it worth the wait?
Marcus Biel: A modularized Java is a major change. No feature should be kicked out of the door before it’s ready. So, yes, it was worth the wait.
For me, the actual question is: Was it the right decision to push back Java’s general progress for several years to make Jigsaw happen? The work on Jigsaw began in 2008, almost 10 years ago! Jigsaw had originally been planned for Java 7. Just look at the intervals between individual Java releases. Before Java 7, it took between one and two years for a release to happen. After that, the time interval kept increasing. Perhaps some of this of this was due to Jigsaw?
In response, Oracle has now switched from its previous feature-driven release plan to a strictly time-driven one. In the future, updates will be published semi-annually without being restricted to any specific features. Therefore, Oracle’s intention seems clear to me. They’ve realised that a single feature shouldn’t disrupt an entire release plan. I can get behind that.
For me, the actual question is: Was it the right decision to push back Java’s general progress for several years to make Jigsaw happen?
JAXenter: Oracle has proposed a new version numbering scheme. What’s your take on that? Do you think it’s a good idea to change it?
Marcus Biel: Generally, I think it’s a good idea to introduce a new version of Java in short, regular cycles.
At the moment, there’s a lot of hype around new “hip” JVM languages like Groovy, Clojure and Kotlin. Why? In my opinion, it’s because the development of Java stalled a bit in recent years. The planned semi-annual release cycle offers the chance to speed up the development of Java again, to streamline and modernize it.
However, the new version numbering scheme hasn’t fully convinced me. “18.3”,”18.9″,”19.3″ — etc. — sounds like “small and insignificant” to me. It also carries the risk of being caught up in a confusion of versions. As a consultant switching between different projects, I’d have to deal with all these different versions in a short space of time: 18.3, 18.9, 19.3 ,19.9 ,20.3. Which Java version is this project currently using? What are the differences? Which features are supported on this project? Which aren’t? What about all the different frameworks and libraries? Will they also switch to half-yearly release cycles?
Finally, I foresee a risk that larger companies will not go along with such frequent changes. Large organizations especially are reluctant when it comes to the expense of software updates. Oracle has perhaps catered for this with the proposed long-term support releases (LTS), so large enterprises will most probably skip the short term releases altogether and stick to the LTS releases every 3 years. Too sad!
JAXenter: Oracle has expressed the desire to release future OpenJDK builds under the GPL license. They also said there will be no technical differences between OpenJDK builds and Oracle JDK binaries. What does this mean and why should users go down the proprietary path?
Marcus Biel: Starting with the JDK 9, Oracle has now published the JDK as an OpenJDK build under the GPL license. You can download it directly from here without having to accept a license. Until now, if you downloaded a Docker image that included the Oracle JDK, you may have unintentionally violated the Oracle license agreement. With Oracle making the OpenJDK freely available, things are much easier now! The entire Java community will benefit from this step, including Oracle, as I am sure this will also further promote the spread of Java! As a Java developer, I’m very happy about this!
Currently, there are still some minor differences between the OpenJDK and the Oracle JDK. For example, the Oracle JDK provides additional tools like Flight Recorder and Mission Control. However, Oracle plans to have removed any differences between the OpenJDK and the Oracle JDK by the end of 2018. OpenJDK will then be the de facto standard. The OpenJDK will still persist alongside the OpenJDK, with Oracle promising continued customer support for it. Furthermore, Oracle will still separately provide commercial features like the Advanced Management Console.
Currently, there are still some minor differences between the OpenJDK and the Oracle JDK.
JAXenter: Is Java 9 as interesting for developers as Java 8?
Marcus Biel: The most important features of Java 8 are without doubt Lambdas and Streams. They’ve changed the way we write code. They’re both very powerful tools, but also very dangerous, as they can be used to write code that is very difficult to understand and maintain.
Jigsaw is the most important feature of Java 9. First, it will mean a lot of maintenance work for us all. As a Clean-Code-Evangelist, however, I see huge potential in Jigsaw for creating more easily maintainable, reusable, well-structured code.
Nevertheless, I doubt that Java 9 will be as interesting for developers as Java 8. Lambdas and Streams provided us with more horsepower – a bigger engine, if you like – for software development with Java. To be blunt, what Jigsaw is now finally giving us is a badly needed Java seatbelt. While the new, shiny, powerful engine was “cool and sexy”, a new seat belt…not so much, unfortunately!