Java 9 - Module System
JPMS (Java Platform Module System) is the significant upgrade in Java 9. module is a self-depicting gathering of code and data
Java 9 modules are one of the greatest change in the structure of java.
A Module is a self-depicting gathering of Code, Data, and a few Resources. It is a lot of related Packages, Types (classes, unique classes, interfaces and so forth) with Code & Data and Resources.
Each Module contains just a lot of related code and information to help Single Responsibility (Functionality) Principle (SRP).
How to Write Modular Codewe should perceive how measured code is written in all actuality.
Create Java Modular Project
Create new modular project.
Create Java Modules
Now add one or two modules in this project.
I have added two modules
test. Let’s see their code and project structure.
Java SE 9 Module System will give the accompanying benefits
- As Java SE 9 is going to partition JDK, JRE, JARs and so on, into littler modules, we can utilize whatever modules we need. So it is anything but difficult to downsize the Java Application to Small devices.
- Ease of Testing and Maintainability.
- Supports better Performance.
- As open isn't simply open, it underpins Strong Encapsulation. (Try not to stress its a major idea. we will investigate it with some valuable models soon).
- We can't get to Internal Non-Critical APIs anymore.
- Modules can cover up undesirable and interior subtleties in all respects securely, we can show signs of improvement Security.
- Application is too little since we can utilize just what ever modules we want.
- Its simple to help Less Coupling between components.
- Its simple to help Single Responsibility Principle (SRP).