Introduction to Project Jigsaw aka Java Platform Module System? How it is going to change the big project development?
Java 9 was a major update in the Java Platform as Java introduced Java Platform Module System, also sometimes referred to as Project Jigsaw.
Jigsaw was the internally used project name during development. Later Jigsaw changed name to Java Platform Module System (JPMS). Java platform is totally changed by this implementation. Now java supports module based implementation. It was a must require feature and high on demand for last couple of years as it will help the developers to manage big projects in smaller independent modules and it also going to help the developers to maintain encapsulation among the packages as well, till Java 8 java supports class level abstraction only.
In JDK 9, java rt.jar is also divided into the modules java 9 have 93 modules and later on with the release of java 10 these modules are increased to 99. These modules can be found in jdk home under jmods directory as you can see in the below image.
What is a Module?
Modularity adds a higher level of aggregation above packages. The key new language element is the module—a uniquely named, reusable group of related packages, as well as resources (such as images and XML files) and a module descriptor specifying- the module’s name
- the module’s dependencies (that is, other modules this module depends on)
- the packages it explicitly makes available to other modules (all other packages in the module are implicitly unavailable to other modules)
- the services it offers
- the services it consumes
- to what other modules it allows reflection
A key motivation of the module system is strong encapsulation
JPMS BENEFITS
- Smaller Application Distributable - Now we can have small size application because java needs to include very less distributable code.
- Encapsulation of Internal Packages- Now packages can be encapsulated and maintained, previously public was too public anyone can access that now public means limited to module.
- Maintainability - Easy to maintain the big project.
- Pre-start detection of missing modules - Java system can identify whether all the required modules are available or not. If it doesn't found any module at startup, Java VM reports the missing module and shuts down.
Comments
Post a Comment