Behavioral Patterns
This chapter explores two new design patterns from the well-known Gang of Four (GoF). They are behavioral patterns, meaning they help simplify system behavior management.
Often, we need to encapsulate some core algorithm while allowing other pieces of code to extend that implementation. That is where the Template Method pattern comes into play. Other times, we have a complex process with multiple algorithms that all apply to one or more situations, and we need to organize it in a testable and extensible fashion. This is where the Chain of Responsibility pattern can help.
In this chapter, we cover the following topics:
- The Template Method pattern
- The Chain of Responsibility pattern
- Mixing the Template Method and Chain of Responsibility patterns