Starting with the modular JDK, you'll see modules are all about strong encapsulation and explicit dependencies. Then it's time to write your own modules, with services to decouple modules.
After the mechanics of creating modules, the first part closes with modularity patterns. They are essential to create truly modular applications.
We all have existing code. Even though the module system is opt-in, there are many changes affecting classpath-based applications as well.
In the second part we explain how you can migrate to Java 9, and then modularize your application. It also features a case study migrating a Spring and Hibernate application to modules.
The last part focuses on tools and processes for modular development, such as Maven. Also, testing modules brings new challenges.
Another exciting tool is jlink. With jlink, you can create small custom runtime images, bundling only the required application modules and JDK modules in a single low-footprint distribution.
The art of structuring large codebases is an undervalued one. This is neither a new problem, nor is it specific to Java. However, Java is one of the mainstream languages in which very large applications are built all the time—often making heavy use of many libraries from the Java ecosystem. Under these circumstances, systems can outgrow our capacity for understanding and efficient development. A lack of structure is dearly paid for in the long run, experience shows.
Modularity is one of the techniques you can employ to manage and reduce this complexity. Java 9 introduces a new module system that makes modularization easier and more accessible. It builds on top of abstractions Java already has for modular development. In a sense, it promotes existing best practices on large-scale Java development to be part of the Java language.
The Java module system will have a profound impact on Java development. It represents a fundamental shift to modularity as a first-class citizen for the whole Java platform. Modularization is addressed from the ground up, with changes to the language, Java Virtual Machine (JVM), and standard libraries.
Now is the time to read up on modules. JDK 9 itself is modularized (shown right) so you will encounter modules right from the start. See how they can improve the structure and integrity of your applications.
— Introduction of Java 9 Modularity
(Excerpt from Chapter 1)
Modularization is hard. Luckily I've been able to use Paul and Sander's book as my guide for writing my Java 9 tutorials, talks, and converting jClarity's applications to use Java's new modular system. I'm buying a copy for all the engineering team at jClarity, it's that good!
CEO, jClarity and Java Champion
This book delivers the essential practical knowledge you need to create modular applications in Java 9. It's a must read for any developer or architect wanting to adopt one of the most significant features the JDK has seen in many years.
Director of Developer Relations, ZeroTurnaround
Sander and Paul are expert practitioners of Java and trusted guides to the Java 9 ecosystem. They were on the front lines of Java 9’s development, and in the vanguard of efforts to migrate popular open source libraries. “Java 9 Modularity” is the handbook for everyone interested in the core principles and best practices of modularity in Java: application developers looking to create maintainable components; library developers looking for advice on migration and reflection; and framework developers wishing to exploit the module system’s advanced features. This book will help you to create Java programs whose structure lets them stand the test of time.
Java Platform Group, Oracle
This two hour video course gives you insight into the Java module system using practical examples. You'll learn how to create and use modules and how to migrate your applications to Java 9.Watch (free trial available)