The Java 9 Module System
Nicolai Parlog
  • MEAP began March 2017
  • Publication in Spring 2018 (estimated)
  • ISBN 9781617294280
  • 275 pages (estimated)
  • printed in black & white
Java's much-awaited "Project Jigsaw" is finally here! Java 9 will include a built-in modularity framework, and The Java 9 Module System is your guide to discovering it. In this new book, you'll learn how the module system improves reliability and maintainability and can be used to reduce tight coupling of system components. You'll then discover how to build, compile, and run your own fully modular applications with best practices and expert techniques. Along the way, you'll also explore Java 9's compatibility challenges and how to migrate your application to the module system.
Table of Contents detailed table of contents

Part 1: Hello, Modules

1. First piece of the puzzle

1.1. What is modularity all about?

1.1.1. Visualizing software as graphs

1.1.2. The impact of design principles

1.1.3. What modularity is all about

1.2. Module erasure before Java 9

1.3. Complications before Java 9

1.3.1. Unexpressed dependencies

1.3.2. Shadowing

1.3.3. Version conflicts

1.3.4. Complex class loading

1.3.5. Weak encapsulation

1.3.6. Manual Security

1.3.7. Startup Performance

1.3.8. Rigid Java Runtime

1.4. Bird's-eye view on the module system

1.5. Goals of the module system

1.5.1. Reliable configuration

1.5.2. Strong encapsulation

1.5.3. Improved security and maintainability

1.5.4. Improved performance

1.5.5. Scalable platform

1.5.6. Non-Goals

1.6. Skills, old and new

1.6.1. What you will learn

1.6.2. What you should know

1.7. Summary

2. Anatomy of a modular application

2.1. The application—monitoring services

2.2. Modularizing the application

2.2.1. Cutting the application into modules

2.2.2. Laying files out in a directory structure

2.2.3. Module declarations (and descriptors)

2.2.4. Writing code is much like before

2.2.5. Compiling and packaging modules

2.2.6. Running the application

2.3. Post mortem—effects of the module system

2.3.1. What the module system does for us

2.3.2. What else the module system can do for us

2.4. Summary

3. Defining modules and their properties

3.1. Modules—the building blocks of modular applications

3.1.1. Java modules (JMODs)--shipped with the JDK

3.1.2. Modular JARs—home-grown modules

3.1.3. Module declarations—defining a module's properties

3.1.4. Types of modules

3.2. Readability—connecting the pieces

3.2.1. Achieving reliable configuration

3.2.2. Unreliable configurations

3.3. Accessibility—defining public APIs

3.3.1. Achieving strong encapsulation

3.3.2. Encapsulating transitive dependencies

3.3.3. Encapsulation skirmishes

3.4. Summary

4. Building modules from source to JAR

4.1. Organizing the project in a directory structure

4.1.1. New convention?

4.1.2. Established default

4.1.3. The place for module declarations

4.2. Compiling a single module

4.2.1. Using the module path

4.2.2. Simple compilation

4.2.3. Incremental compilation

4.3. Compiling multiple modules

4.3.1. The naive approach

4.3.2. The module source path

4.3.3. The asterisk as a token for the module name

4.3.4. Multiple module source path entries

4.3.5. Setting the initial module

4.3.6. Is it worth it?

4.4. Compiler options

4.5. Packaging a modular JAR

4.5.1. Quick recap of jar

4.5.2. Analyzing a JAR

4.5.3. Defining an entry point

4.5.4. Archiver options

4.6. Summary

5. Running modular applications

Part 2: Real World Applications

6. Compatibility challenges when moving to Java 9

7. Modularizing existing applications

8. Services — configuring applications with the module path

9. Refining dependencies and APIs

10. Reflection in a modular world

11. Runtime images with jlink

12. Troubleshooting

About the Technology

Experienced developers understand the benefits of strong encapsulation; when two components can interact only through the interfaces you define, you reduce the chance that you'll introduce hidden dependencies and unwanted tight coupling into your code. The Java Module System, aka "Project Jigsaw", gives Java developers the ability to define and enforce modularity without an outside framework. A modular application allows a team to more-safely approach large projects and produce cleaner code with superior run-time stability. The benefits don't just stop there however, the shift to modules also promises reliable configuration - allowing individual modules to declare their dependencies on other modules, along with allowing both the developers and JVM the same vision of the running application; changing how you develop with Java for the better!

About the book

  • The anatomy of a modular Java app
  • Building modules from source to JAR
  • Compiling both single and multiple modules
  • Debugging your finished applications

About the reader

If you are a developer who has experience working with Java, then this book is perfect for you.

About the author

Nicolai Parlog is a thirty year old boy, as the narrator would put it, who has found his passion in software development. He constantly reads, thinks, and writes about it, and codes for a living as well as for fun. He is the editor of SitePoint's Java channel, blogs about software development on codefx.org, and is a long-tail contributor to several open source projects. The best way to get in touch is via Twitter.

Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
Buy
MEAP combo $44.99 pBook + eBook
MEAP eBook $35.99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks