Problems with Java modules still plague developers – TheServerSide.com

Khunatorn – stock.adobe.com
Famous philosopher George Santayana once said, “Those who cannot remember the past are condemned to repeat it.” In the case of the Java Platform Module System (JPMS), the past has most certainly repeated itself.
As a rank-and-file Java developer, I view the Java module system as a failure. JPMS does what it says on the tin — it’s something Java needed — but it repeats the failures of the Open Service Gateway Initiative (OSGi) ecosystem that’s been around nearly as long as Java itself.
OSGi is a system for modular components that contains a few specifications: one for the components themselves (what they can do, their lifecycle, how they declare dependencies), and another for a container in which those components run.
It sounds like a familiar pattern, doesn’t it?
JPMS borrows from module systems like OSGi and JBoss Modules, which is both good and bad. It’s good because it means it uses real-world experience to define itself. However, it’s bad because it repeats the same mistakes.
The main thing JPMS adds to the prior specifications is built-in JVM support, whereas OSGi and JBoss Modules rely on a container abstraction. In these systems, developers need to run an application — like Karaf, Equinox or Felix — and tell the container to deploy modules, similar to a Jakarta EE application.
With JPMS, however, because it’s part of the JVM, you have a simple implementation path. First, developers can compile the modules (properly, one hopes), then tell the JVM how to resolve the modules and what entry point to use to run the modules.
Wait — those are the same steps.
JPMS is a necessary part of improving development. However, it suffers from the same major problem that plagues OSGi.
What did OSGi get wrong? Seeing as JBoss Modules and JPMS came to be after OSGi — with much of the same core goals — it tells us that the objectives are fine. But why is OSGi so insufficient that we must keep reinventing it?
The container requirement is a problem JPMS solves because it’s no longer dependent on an external application. The OSGi containers are workable, but they’re still extra things.
This is where a specification helps everyone. A product compliant with a specification is required to behave in ways consistent with the specification, and deployments don’t have to wonder if something might work or not. And if they need a feature of a specific container, they can compensate for that at runtime.
What OSGi does isn’t wrong, either. Again, the modular deployment structure is something that both JBoss Modules and JPMS have replicated, although in different ways.
What OSGi failed to address, and the mistake JPMS has repeated, is tooling.
To be clear, there are tools for OSGi: bnd is one of the most popular tools and even supports JPMS. However, even bnd suggests that developers use an IDE to develop with, such as Eclipse. It uses a project.bnd file to control the dependencies, like how JPMS uses a module-info.java.
Now we’re back at the beginning of the cycle where everything old is new again. There are plugins for Maven and Gradle to invoke bnd, and because module-info.java is an actual source file, it is part of the compilation process in a way that a project.bnd file is not.
However, using JPMS is still largely a matter of trial and error, even though it does some things better than the older systems. The ecosystem support hasn’t caught up. The Java tooling is just not there to aid library developers to consistently and elegantly support modules. As a result, using a library from Java’s ecosystem — arguably its greatest strength — relies on hoping that modules are supported, and that the module support was done properly.
You don’t want to hope something works when your productivity is on the line. You want it to work, and that means there are lots of developers who’ll try JPMS for their projects and fall back to the old non-modular system pretty early because the modules aren’t supported properly yet for the libraries we use.
Until JPMS addresses that — and so far we’ve seen little hope on the horizon for such concerns — JPMS will always be like OSGi and JBoss Modules before it: a great idea that gets ignored when real work needs to be done.
Application modernization should be at the top of an enterprise’s to-do list for five reasons, including security concerns, …
While CQRS can provide a lot of value when it comes to structuring an event-driven architecture, improper practices can cause …
Naming APIs can be a daunting process, since it requires a balance between simplicity and clarity. JJ Geewax, author of ‘API …
Trends come and go, but AIOps and MLOps, spatial computing, and a low-code and high-code toolkit are the future of software …
OrgScan extends CodeScan’s security scanning ability in Salesforce. CodeScan Shield aims to simplify security for devs as the …
A software team needs quality to ensure a strong product. Here are some ways to implement quality in all facets of development …
Discover the differences between Azure Data Factory and SSIS, two ETL tools. These contrasts include key data management features…
An extension of the Azure DevOps service, Azure Artifacts can help developers manage and share packages to streamline the overall…
Oracle is allowing its database users to access those services on rival clouds, while aggressively pursuing AWS customers in …
A threat actor this weekend published in-development footage from a forthcoming ‘Grand Theft Auto’ video game and claimed to have…
Bug bounty programs have a number of benefits and challenges. Before adopting such a program at your organization, read up on the…
The U.S. Department of Justice issued a report to President Biden on its various enforcement efforts around cybercrime and …
Many organizations struggle to manage their vast collection of AWS accounts, but Control Tower can help. The service automates …
There are several important variables within the Amazon EKS pricing model. Dig into the numbers to ensure you deploy the service …
AWS users face a choice when deploying Kubernetes: run it themselves on EC2 or let Amazon do the heavy lifting with EKS. See …
All Rights Reserved, Copyright 2000 – 2022, TechTarget

Privacy Policy
Cookie Preferences
Do Not Sell My Personal Info

source

Leave a Comment