Structural Patterns
This chapter explores four design patterns from the well-known Gang of Four (GoF). We use structural patterns to create complex, flexible, and fine-grained classes.
Structural patterns help us build and organize complex object hierarchies in a maintainable fashion. They allow us to add behaviors to existing classes dynamically, whether we designed the initial system this way or as an afterthought that emerges out of necessity later in the program’s lifecycle.
The following topics will be covered in this chapter:
- Implementing the Decorator design pattern
- Implementing the Composite design pattern
- Implementing the Adapter design pattern
- Implementing the Façade design pattern
The first two patterns help us extend a class dynamically and efficiently manage a complex object structure. The last two help us adapt an interface to another or shield a complex system with a simple interface. Let’s begin!
...