Chapter 2. Structural Patterns: Decorator, Proxy, and Bridge
We start our tour of design patterns with the group known as the structural patterns. There are seven patterns that make up the structural group, each with the role of building flexibility, longevity, and security into computer software. The names of the patterns are important, so I’ll introduce them immediately. They are:
Structural patterns are concerned with how classes and objects are composed to form larger structures. Of the many purposes of the seven structural patterns, here are 10:
Add new functionality dynamically to existing objects, or remove it (Decorator).
Control access to an object (Proxy).
Create expensive objects on demand (Proxy).
Enable development of the interface and implementation of a component to proceed independently (Bridge).
Match otherwise incompatible interfaces (Adapter).
Reduce the cost of working with large numbers of very small objects (Flyweight).
Reorganize a system with many subsystems into identifiable layers with single entry points (Façade).
Select or switch implementations at runtime (Bridge).
Simplify the interface to a complex subsystem (Façade).
Treat single objects and composite objects in the same way (Composite).
Structural patterns can be employed while a system is being designed, or later on during maintenance and extension. In fact, some of them are specifically useful in the post-production stages of the lifecycle of a software system, ...