Chapter 4. Structural Patterns
In the previous chapter, we looked at a number of ways to create objects in order to optimize for reuse. In this chapter, we'll take a look at structural patterns; these are patterns that are concerned with easing the design by describing simple ways in which objects can interact.
Again, we will limit ourselves to the patterns described in the GoF book. There are a number of other interesting structural patterns that have been identified since the publication of the GoF and we'll look at those in part 2 of the book.
The patterns we'll examine here are:
- Adapter
- Bridge
- Composite
- Decorator
- Façade
- Flyweight
- Proxy
Once again, we'll discuss whether the patterns that were described years ago are still relevant for a different language and a different time.
Adapter
From time to time there is a need to fit a round peg in a square hole. If you've ever played with a child's shape sorting toy then you may have discovered that you can,...