10 May 2016
Programming language trends: Java 9
Java has been around since the nineties, but it''s still alive and well. It''s disappeared from the browser but is widely used for web applications and Android applications. Java 9 is due to come out in March 2017, with some pervasive changes designed to help both very big and very small applications.
Java has always had a coordination problem when different chunks of code come together. JAR (Java Archive) files hold runnable code, and a JAR is often the result of putting multiple smaller JARs together. Some of these are common, open source code. Both JAR A and JAR B might incorporate the same utility package — let''s call it X. The Java runtime can load only one copy of X. If they''re both the same, there''s no problem. If they''re different versions, though, it''s more or less a matter of luck which one gets loaded. If JAR A and JAR B each depend on the different versions of X that they''re using, one of them might stop working when the runtime loads the other version. Developers call this situation "JAR hell."
To fix this problem, Java 9 introduces modules. A module is "a named, self-describing collection of code and data." A module can specify what code it requires and what it makes available to other modules. A JAR file with the needed descriptive information defines a module.
The module path instructs the Java runtime where to find module dependencies. The same package can independently exist within two different modules, but if a required module is missing or there''s a conflict that modularization doesn''t resolve, the loader will quit.
The result of modularization should be more stable code. Java 9 will have lots of other features, of course, but this one is drawing more discussion than any other.
To learn about the digital strategies we offer, please contact us.