Module Design Patterns and Strategies

In the previous few chapters, we did a deep dive into several modularity features in Java 9 that enable you to build Java applications with modules. You've learned how to use the dependency declarations and services to establish module dependencies. You've also learned how to use jlink to build modular runtimes that can be distributed. In this chapter, we'll look at a slightly less objective concern--how to build good applications with modules in Java. Now that you've acquired the knowledge to create and use modules, what are the recommended ways to do that? What are the best practices and patterns that you should use? Here's what we'll cover in this chapter:

  • Understanding how to design modules--what a module should ideally be and where module boundaries should be drawn
  • Understanding how to design good APIs for those modules
  • Learning about several best practices to create modules, as well as patterns, to use the module system effectively

Many of the patterns discussed in this chapter come with usable code examples, available in the folder 09-module-patterns. Each example has been carefully crafted to help explain the pattern being discussed with minimal information overhead. Feel free to use and experiment with these code examples as you explore these patterns. Also, remember to revisit this chapter during your Java 9 modularity journey to brush up your knowledge of these patterns. It's often the case that rereading and thinking about design patterns at any time offers new perspectives to the challenges you have going on at that time.

Let's get started!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.246.148