In this video, Nick Maiorano discusses the aspects of modularity that have been introduced or improved upon as part of JPMS, and how they relate to the five pillars of modularity.
- [Instructor] Modularity is a continuum. In reality, you never have a fully modular or fully monolithic system, just varying degrees in between. For the first eight versions, Java has had constructs and tools that take you a long way towards building modular applications. Think of a Java class, it's a way to group state and behavior together. It delivers a specific set of functionality. This plays to the encapsulated aspect of modularity. Java also has interfaces that allow different implementations to be mixed and matched.
Interfaces enable interoperability. And there are many more examples. Think of how Jar files enable Java systems to be composable, by bringing together different packages and by substituting one library by another. Or how Java systems can be expanded or reduced by creating more or less instances of objects. And finally, think about how classes and packages allow different functionalities to run autonomously from one another.
These are just some examples of how modularity is already baked into Java. So it's not a foreign concept. If Java's already modular, what is JPMS trying to fix? JPMS is mostly about improving modularity in Java. And these improvements are not trivial. They address something that was always lacking on the Java platform. So how exactly does JPMS improve modularity? Well, it makes modularity reliable, encapsulation stronger, and Java systems decomposable.
Let's address each of these separately. Reliable modularity eliminates surprises that come from inconsistencies between the environment at compile time versus run time. It provides tools and constructs that detect inconsistencies. Stronger encapsulation governs how packages expose classes to the outside world. This is similar to how classes control visibility of their methods and attributes to outside classes but apply that the next level of lexical scoping.
Decomposability streamlines the size of Java systems and removes unneeded components from applications in the platform itself. JPMS directly or indirectly improves upon how Java realized the five pillars of modularity. Stronger encapsulation plays to the encapsulated pillar, reliable modularity improves interoperability, composability, and autonomy, while decomposable Java improves upon the expandability of systems. So while the Java platform already has some support from modularity, JPMS takes it to a whole new level.
In this course, instructor Nick Maiorano breaks down this complexity by explaining what modularity is all about, how Java has adopted modularity and how to start using to build better quality applications.
- What is modularity?
- The five pillars of modularity
- Modularity in the real world
- JPMS concepts and syntax
- Designing and implementing a modular structure
- Compiling, packaging and running modular applications
- Using the dependency checking tools
- Creating custom runtime images
- Managing backward compatibility with classes and modules
- Explicit, unnamed, and automatic modules
- JPMS tips and recommendations