MΓ³dulo 23 Β· Design Patterns (All 23 GoF) β LecciΓ³n 13 de 23 Β· ~6 min
Chain of Responsibility
Chain of Responsibility: pass a request down handlers
Problem: several checks must run in order, and the first failure should stop the rest.
PawWalk scenario: a booking validation pipeline β availability, then payment, then policy. If availability fails, don't bother charging.
In Ruby the whole chain is often just an array of callables you run until one returns a failure. No linked-list of handler objects required.