The world of software design is full of good ideas. The really good ideas get repeated and form repeatable patterns. Knowing – and using – these patterns of software design can save the developer from burning a lot of brain calories trying to reinvent something that's been developed already. In this chapter, we looked at a few of the most common patterns:
- The Decorator pattern is used in the Python language to add features to functions or classes. We can define decorator functions and apply them directly, or use the
@syntax to apply a decorator to another function.
- The Observer pattern can simplify writing GUI applications. It can also be used in non-GUI applications to formalize relationships between objects that change state, and objects that display or summarize or otherwise use the state information.
- The Strategy pattern is central to a lot of object-oriented programming. We can decompose large problems into containers with the...