Java 9 Modules

Jun 11, 2018 9:05:00 AM

Java 9 ModulesIn the world of software development, enhancements in development tools and platforms tends to be incremental. Certainly, new tools, frameworks, and platforms that ease the job of software development or software project management come along with sometimes mind-spinning regularity, and we have discussed a good number of them in this space. But after that initial release, revolutionary enhancements of those tools in functionality, capability, and ease of use are pretty rare.

Why is this? Opinions vary (of course), but it seems that the main thing preventing (or delaying) major enhancements to development tools is the fact that it’s really hard to do without either breaking applications that have already been built or making it more difficult to update them.

So in those rare cases where a major enhancement to an established development tool or platform comes along, it’s big news (at least to developers). Such is the case with Java 9 modules.

What Are Java 9 Modules?

Java 9 modules, or more formally the Java 9 Platform Module System (JPMS), introduces a higher level of organization for Java code. In previous versions of Java, code was organized into units called packages. The Java Platform included hundreds of these packages, which led to a number of problems:

  • Security: The architecture of the package environment makes it easier for attackers to exploit security holes by exposing internal APIs—even if they aren’t explicitly used in a given application.
  • Scalability: With packages only, applications can become bloated with the large size of the Java runtime. This causes a problem for the increasing number of IoT devices that are resource-constrained.
  • Performance: The package-only architecture makes it difficult to optimize applications for speed, memory use, and other performance factors.

JPMS does not do away with packages; rather, the Java ecosystem is organized into buckets of packages called modules. More than just an organizational tool, however, modules enable developers to exercise greater control over their applications than was afforded by packages alone.

Advantages of Java 9 Modules

Some of the things developers will enjoy about using Java 9 modules include the following:

  • Subsetting the Java Development Kit: Modules enable developers to create a subset of the Java Development Kit (JDK) that includes only the modules that are needed for a particular application. Goodbye, bloat.
  • Controlling relationships between modules: Modules must explicitly define dependency relationships with packages in other modules. Any relationships that are not explicitly defined are considered to be nonexistent. During compilation, the Java system recognizes these relationships and includes only those packages that are needed in the application. This enhances security, reduces bloat, and enhances performance.

The result for developers—and their customers—is leaner, more secure applications that can run efficiently on a much wider variety of hardware platforms and devices.

How We (Finally) Got Here

The advent of JPMS—described in Java Magazine as “the most important new software engineering technology in Java since its inception”—didn’t happen overnight, and was not without controversy. Originally proposed in 2011 for Java 7, the project was deferred several times while designers grappled with technical and philosophical issues. Figuring out how to organize hundreds of packages into the 95 modules of the initial release, in a way that makes sense for the vast majority of developers, was no easy task. Several years of hard work finally paid off with the release of JPMS in late 2017.

If there is a downside, it’s that existing applications may require some extensive architecture updates to take advantage of Java 9 modules. At some point, Oracle will sunset the earlier Java versions with which those applications were developed, ending official support, and developers and their customers will need to make some choices about what to do with those legacy applications.

AndPlus and Java 9 Modules

Regular readers of this blog will not be surprised to learn that AndPlus is on top of this major enhancement to the Java development environment, and we are excited about the enhanced security and performance inherent in new Java applications. If you have an idea or a need for a new application, or have an old application that’s in desperate need of an update, contact us today. If Java is the right platform for your application, we will make sure it takes full advantage of the enhancements brought about by Java 9 modules.

Contact Us Now

Topics: Java 9 Modules

Brian Geary

Written by Brian Geary

Brian is a true believer in the Agile process. He often assists the development process by performing the product owner role. In addition to his technical background, he is an experienced account manager with a background in design and marketing.

Lists by Topic

see all