Chapter 4. Add feature modules

 

This chapter covers

  • Defining feature modules and how they fit into our architecture
  • Comparing feature modules and third-party modules
  • Explaining the fractal MVC design pattern and its role in our architecture
  • Setting up files and directories for feature modules
  • Defining and implementing the feature module APIs
  • Implementing commonly needed feature module capabilities

Before you begin, you should have completed chapters 13 of this book. You should also have the project files from chapter 3 as we’ll be building on them. We recommend you copy all the files and the whole directory structure you created in chapter 3 into a new “chapter_4” directory so you may update them there.

A feature module provides a well-defined and scoped capability to the SPA. In this chapter we move the chat slider capability introduced in chapter 3 into a feature module and improve its capabilities. Besides the chat slider, examples of other feature modules might include an image viewer, an account management panel, or a workbench where users might assemble graphical objects.

4.1. The feature module strategy

4.2. Set up feature module files

4.3. Design method APIs

4.4. Implement the feature API

4.5. Add frequently needed methods

4.6. Summary