Structural Patterns
This chapter explores four structural design patterns from the well-known Gang of Four (GoF).
We use structural patterns to build and organize complex object hierarchies in a maintainable fashion. They allow us to dynamically add behaviors to existing classes, whether we designed the initial system this way or as an afterthought that emerges out of necessity later in the program’s lifecycle. Structural patterns promote reusability and enhance the overall flexibility of the system.
In this chapter, we cover the following topics:
- The Decorator design pattern
- The Composite design pattern
- The Adapter design pattern
- The Façade design pattern
The first two patterns help us extend a class dynamically and efficiently manage a complex object structure. The Adapter pattern helps us connect an existing interface to another incompatible interface, enabling communication between two different systems. The Façade...