Part 1 of 6 · 1 min read
Why this page comes eighth
In this module you will
- State the Chain of Responsibility pattern and say when it fits.
- Write an approval chain with a successor link.
- Write a validation chain as a list of checks.
- Handle a request that falls off the end of the chain.
- Tell it apart from Decorator and Command, and know where it appears in real systems.
The earlier patterns had the sender pick the receiver. Here the sender does not know which of several objects will handle a request, and does not need to. The pattern shows up in approval flows, validation steps and request filters in web servers, so it suits "expense approval", "support ticket escalation" and "request pipeline" prompts. The source is "Design Patterns" (GoF) chapter 5. Code was compiled and run before it was written here. Numbers marked "made up" only show the idea.