Chapter 3. Module Design Pattern
Now that we have reviewed some important JavaScript OOP concepts in the previous chapter, we are going to leverage some of the techniques discussed to create modules and start using them in our application.
You are probably familiar with the term design pattern, which is essentially a way of structuring code as a reusable solution for common programming problems. In this chapter, we are going to focus on a particular design pattern in JavaScript called module pattern.
We will explore how we can create simple modules using this pattern and then we will build upon these modules to create our application's modules in the following chapters.
Module pattern is one of the most frequently used patterns in JavaScript for creating modular applications.
Some of the topics that we will discuss in this chapter are:
- Structure of module pattern
- Internal private scope in module pattern
- How to create simple modules
- How to create a module factory