15 Putting the pieces together


This chapter covers

  • A bells-and-whistles version of ServiceMonitor
  • Whether to use modules
  • What an ideal module might look like
  • Keeping module declarations clean
  • Comparing the module system to build tools, OSGi, and microservices

Now that we’ve covered pretty much everything there is to know about the module system, it’s time to wrap things up. In this final chapter, I want to connect the dots and give a few pieces of advice for creating awesome modular applications.

The first step is to show you an example of how the various features discussed throughout the book can come together by applying most of them to the ServiceMonitor application (section 15.1). Then I’ll take a deep dive into a number of more general concerns that will help you decide whether to even create modules, what to aim for when doing so, and how to carefully evolve your module declarations so they stay squeaky clean (section 15.2). I’ll close with a review of the technology landscape surrounding the module system (section 15.3) and my vision for Java’s modular ecosystem (section 15.4).

15.1 Adding bells and whistles to ServiceMonitor

15.1.1 Diversified dependencies

15.1.2 Reduced visibility

15.1.3 Decoupled with services

15.1.4 Loads code at run time with layers

15.1.5 Handles dependencies on plain JARs

15.2 Tips for a modular application

15.2.1 Modular or not?

15.2.2 The ideal module

15.2.3 Take care of your module declarations

15.2.4 Breaking code by editing module declarations

15.3 The technology landscape

15.3.1 Maven, Gradle, and other build tools

15.3.2 OSGi

15.3.3 Microservices

15.4 Thoughts on a modular ecosystem