Grokking Design Patterns for Engineers and Managers
Vote

0% completed

Chain of Responsibility Pattern

The Chain of Responsibility Pattern passes a request along a line of handlers until one of them deals with it or stops it.

A request has to clear several checks before the real work happens. Authenticate the caller. Check the rate limit. Validate the payload. Then create the order.

Written directly, one method does all four, and it grows every time a rule is added. The order of the checks is buried in the method body, and it matters: authenticating before rate limiting is not the same as rate limiting before authenticating.

Then some routes need only two of the four

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content