2 Anatomy of a modular application

 

This chapter covers

  • Laying out a modular application’s source code
  • Creating module declarations
  • Compiling modules
  • Running a modular application

This chapter introduces you to the overall workflow of creating modular applications, but it doesn’t explain these topics in all detail. Chapters 3, 4, and 5 do that—they explore these subjects in depth. But with a topic as encompassing as the module system, it can be easy to miss the forest for the trees. That’s why this chapter shows you the big picture. It gives you an impression of how the different pieces of the puzzle fit together by presenting a simple modular application, how its modules are defined and compiled, and how the application is executed.

That means I make you jump into the deep end: not everything that follows may be immediately obvious. But don’t worry if something’s unclear—it will be thoroughly explained soon. When you’re done with part 1 of this book, everything in the example will make perfect sense. So dog-ear these pages, because you may want to refer back to them.

2.1 Introducing ServiceMonitor

2.2 Modularizing ServiceMonitor

2.3 Cutting ServiceMonitor into modules

2.4 Laying out files in a directory structure

2.5 Declaring and describing modules

2.5.1 Declaring dependencies on other modules

2.5.2 Defining a module’s public API

2.5.3 Visualizing ServiceMonitor with the module graph

2.6 Compiling and packaging modules

2.7 Running ServiceMonitor

2.8 Extending a modular code base

2.9 Post mortem: Effects of the module system

2.9.1 What the module system does for you

2.9.2 What else the module system can do for you

2.9.3 Allowing optional dependencies

Summary

sitemap