Leveraging Behavioral Design Patterns
Behavioral design patterns help to organize communication between objects. This includes the ability to extend functionality without modifying these existing classes. By implementing the behavioral design patterns covered in this chapter and how they’re used in the JavaScript ecosystem, we’ll learn to build JavaScript applications that can be extended without touching existing functionality.
We’ll cover the following topics in this chapter:
- An understanding of the behavioral design pattern classification
- An implementation of the observer pattern and how the common Web
EventTarget
API exposes it - Implementations of the state and strategy pattern, both with a class-based approach and a function-based approach
- A simplified visitor example, as well as common usage for the visitor pattern in the JavaScript ecosystem
By the end of this chapter, you’ll be able to leverage behavioral design patterns...