Chain of responsibility
medium 45 minA request travels past several handlers until one takes it, or until one stops it.
Watch lesson4:36
Explain your choices
Answer first. Then compare your reasoning.
15 questions 0 got it 0 to review15 not marked
Defend
Choice, reason, cost, trigger
| Choice | Reason | Cost | I would change it when |
|---|---|---|---|
| List and runner | Handlers do not know each other | No work after the rest | A link must wrap, then compose functions |
| Catch-all at the end | Nothing is lost | Hides missing rules | Missing rules are bugs, then an exception |
| canHandle apart from resolve | Can be asked without effects | The condition may be computed twice | It is expensive, then one method with an outcome |
| Fail closed for security | No hole under failure | An outage stops sales | Never for permission, sometimes for fraud score |
| Immutable chain | No half changes | A new list per change | Never |