Advanced Design Patterns
In this chapter, we will be introduced to several more design patterns. Once again, we'll cover the canonical examples as well as any common alternative implementations in Python. We'll be discussing the following:
- The Adapter pattern
- The Façade pattern
- Lazy initialization and the Flyweight pattern
- The Abstract Factory pattern
- The Composite pattern
- The Template pattern
The case study for this chapter will demonstrate how to apply a few of these patterns to the iris sample problem. In particular, we'll show how much of the design has been based – implicitly – on a number of these patterns.
Consistent with the practice in Design Patterns: Elements of Reusable Object-Oriented Software, we'll capitalize the pattern names.
We'll begin with the Adapter pattern. This is often used to provide a needed interface around an object with a design that doesn't –...