Design Patterns (GoF) (50 Qs)•Part 3: Architectural Patterns & Enterprise Systems (25 - 35)
Chain of Responsibility Pattern: Middleware pipelines and event bubbling.
mid LevelPipesCI/CD & DevOps
In Simple Words: Avoids coupling the sender of a request to its receiver by giving multiple objects a chance to handle the request:
- Handlers are chained together sequentially. Each handler decides either to process the request and/or pass it to the
next()handler in the chain. - Real-World Examples:
- Web framework HTTP middleware (Express.js, ASP.NET Core, Spring Filters):
CorsMiddleware -> AuthMiddleware -> RateLimitMiddleware -> Controller. - DOM event bubbling and UI event responders in macOS / iOS.
- Web framework HTTP middleware (Express.js, ASP.NET Core, Spring Filters):