Implementing Structural Design Patterns
Structural design patterns give us tools to handle connecting different objects; in other words, managing the relationships between objects. This includes techniques to reduce memory usage and develop functionality with existing classes without modifying these existing classes. In addition, JavaScript features allow us to more effectively apply these patterns. Modern JavaScript includes some built-ins that allow us to implement structural design patterns in a more efficient manner.
We’ll cover the following topics in this chapter:
- Defining structural design patterns as a whole, and proxy, decorator, flyweight, and adapter specifically
- An implementation of the proxy pattern with a class-based approach as well as an alternative using Proxy and Reflect
- Multiple implementations of the decorator pattern, leveraging JavaScript first-class support for functions
- An iterative approach to implementing flyweight in JavaScript...