Chapter 24: The Chain of Responsibility Pattern
We now cover the Chain of Responsibility design pattern, which should be used, as we will see, when we do not know the number and type of requests/events we would need to support. While this may seem vague, this pattern is useful among a wide range of use cases, such as event-based systems, purchase systems, and shipping systems.
In this chapter, we will learn what the Chain of Responsibility pattern is, its benefits, and—as always—how to implement it in a practical Python example. We will discuss the following topics:
- Understanding the Chain of Responsibility pattern
- Real-world examples
- Use cases
- Implementation