Interview with Rabea Gransberger

Java 9: “I’d highly recommend developers get familiar with modules”

Dominik Mohilo
Java 9

Project Jigsaw, Java’s new modular system, is the star of Java 9. We talked with Rabea Gransberger, software developer at MEKOS and organizer of JUG Bremen, about the new release, the modular system, what’s still missing in this release and the plans for an all-new and significantly shortened release cycle.

JAXenter: What is the most important feature of Java 9?

Rabea Gransberger: Java 9 contains a lot more than just Jigsaw. There are the small API adjustments to Collection Factories, Streams, Optional and Process, there are the language-adjustments for try-with-resource, private methods in interfaces and diamond for anonymous classes. All of these will be of use to developers in their everyday work much more often. Furthermore, REPL and Misson Control/Flight Recorder are tools for all developers and everyday use that haven’t been free to use until now, Those will also make some things easier. Like, when you want to know when check-in will be available for a flight you booked and the website just tells you it’s in 44 days from now. But which date is that?

$1 ==> 2017-11-08

Very useful!

JAXenter: Was project Jigsaw worth the wait?

Rabea Gransberger: I basically like it, that new features don’t get introduced head over heels, even though it results in longer waiting times for new features than with other languages. a new feature that no one understands or that is hard to use just isn’t worth the faster release time. The possibility to facilitate different code for different Java-versions in one JAR will increase backwards compatibility without creating any restrictions for adoption of new and more performant features. You can profit from modularization of the JDK in your own projects by using JLink. Just add self-contained, executable modules to shipment. There is no need to include the whole JRE, just work with the modules you need.

JAXenter: Will you start working with Jigsaw right away or are you rather on the skeptical side when it comes to modules?

Rabea Gransberger: Since we are working on Eclipse RCP apps in our organization, we utilize OSGi, which has modularization. So I’m already used to working with modules and don’t need Jigsaw for that right now. Modules offer a possibility to create a representation of architectures within the code, that is closer to the one designed on paper.

Jigsaw makes it finally possible to prohibit access to public classes that were designed for internal use only or restrict access to specific modules by name, stopping “Balls of Mud” from accruing since it will be virtually impossible for all code to call any other code.

We started six years ago to transform our monolithic main project into OSGi Bundles, which are similar to modules. We created 150 Bundles in the meantime. When a module prohibits access to a specific API, it makes you think about what you were really trying to do there – does it even make sense? APIs from module A, that you tried to call from module B will be better placed in their own module C a lot of times because module A and B don’t have anything to do with one another.

 I’m already used to working with modules and don’t need Jigsaw for that right now.

Developers need to change the way they think about code when working with modules, but I’d highly recommend them get familiar with them nonetheless, and to start integrating modules into their own project bit by bit. Unfortunately, we’ll need to wait until all necessary libraries are modularized too. If they are not, you might want to point the dev team at that by writing a bug report or a pull request.

SEE ALSO: “The most substantial argument in favor of Java 9 is the modularization of JDK itself”

JAXenter: Which features would you have liked to see in Java 9?

Rabea Gransberger: I’m used to having the option to not just exporting packages, but also import them to OSGi. Dependencies are reduced to single packages by this, instead of covering whole modules/bundles. That’s quite beneficial when a library you use is separated into different bundles – your code will still compile, as long as the packages stay intact. OSGi also offers quite nice versioning for bundles and the option to specify a version scope for dependencies, so you will be notified of new library versions on class path that you haven’t tested yet.

Time will tell whether Java 9 really lacks these features. If you are utilizing build tools like Maven or Gradle to build Java 9 modules, the version control they offer might already be sufficient.

Many projects today require a lot of time to switch from one Java version to the next. 

JAXenter: Java will be released biannually from now on. Do you think that is a good idea?

Rabea Gransberger: I’m rather skeptical about that, but that might just be because I’m quite used to waiting a few years for a release. I’ve, however, already interviewed lots of applicants who just don’t know what Java version they are working with even today. When it comes to using new language features and APIs, it really makes a big difference if someone is familiar with the version we are using or not.

Many projects today require a lot of time to switch from one Java version to the next. It might partially be related to the large number of changes every major release brought forward, so things might proceed a lot faster if we are just talking about a single feature per release. Speaking of my desktop projects, this implies we really need to start including our own JRE on delivery instead of relying on the Java version installed on the client computer.

SEE ALSO: “JDK 9 does not have big features for developers, it’s about changing the runtime with modularity”

JAXenter: What’s your take on the current efforts undertaken by Oracle to make Java and Java EE more open?

Rabea Gransberger: News came in fast over the last couple of weeks. Starting from upgrading OpenJDK and Java Flight Recorder, moving JavaEE to the Eclipse Foundation and further with the provision of IBM J9 VM (also at Eclipse). I’m happy to see more and more of Java going open source. You can learn a lot from these projects and even contribute to them.

As long as Oracle or some other company or person is still working as project lead full time, I’m sure things will go smoothly. In contrast to that, looking at projects without a professional project lead, contributors will work on whatever they are interested in right now and lose sight of the bigger picture. This not to criticize those developers; I get why this happens. However, speaking from a user’s point of view, those projects suffer from lack of leadership.

Thank you!

Don’t miss Donald Smith’s keynote at JAX London about the current status of Java SE. He will give a quick overview of how OpenJDK plays a key role in the Java SE ecosystem, followed by details of the proposed plan and its current status.The keynote will be followed by a panel whereby the two key proposals – increased cadence and Oracle produced OpenJDK builds – will be discussed for pros and potential gotchas. Panelists include Daniel Bryant, Stephen Colebourne and Peter Lawrey.


Dominik Mohilo
Dominik Mohilo studied German and sociology at the Frankfurt University, and works at S&S Media since 2015.

comments powered by Disqus