Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/all-anchors.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ include::anchors/pyramid-principle.adoc[leveloffset=+2]

== Design Principles & Patterns

include::anchors/chain-of-responsibility.adoc[leveloffset=+2]

include::anchors/dry-principle.adoc[leveloffset=+2]

include::anchors/fowler-patterns.adoc[leveloffset=+2]
Expand Down
46 changes: 46 additions & 0 deletions docs/anchors/chain-of-responsibility.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
= Chain of Responsibility
:categories: design-principles
:roles: software-developer, software-architect
:proponents: Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides
:related: gof-design-patterns
:tags: design-pattern, behavioral, middleware, pipeline, handler-chain, request-processing

[%collapsible]
====
Also known as:: Handler Chain, Middleware Pattern

[discrete]
== *Core Concepts*:

Handler chain:: Request passes along an ordered chain of potential handlers

Process or pass:: Each handler decides to process the request, pass it to the next handler, or both

Decoupled sender and receiver:: Sender doesn't know which handler will process the request

Middleware pattern:: Modern incarnation in web frameworks (Express.js, Django, ASP.NET middleware pipeline)

Dynamic chain composition:: Handlers can be added, removed, or reordered at runtime

Single responsibility:: Each handler focuses on exactly one concern (authentication, logging, validation)

Fallback handling:: Default handler at the end of the chain for unhandled requests

Short-circuit capability:: Handlers can terminate the chain early (e.g., reject unauthorized requests)


Key Proponents:: Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides ("Design Patterns", 1994)

[discrete]
== *When to Use*:

* Request processing pipelines (HTTP middleware, bot handler groups)
* Event handling with multiple potential handlers
* Validation chains with multiple independent rules
* Logging, authentication, and authorization layers

[discrete]
== *Related Anchors*:

* <<gof-design-patterns,GoF Design Patterns>> - Chain of Responsibility is one of 23 GoF behavioral patterns
====
5 changes: 5 additions & 0 deletions skill/semantic-anchor-translator/references/catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ Source: https://github.com/LLM-Coding/Semantic-Anchors

## Design Principles

### Chain of Responsibility
- **Also known as:** Handler Chain, Middleware Pattern
- **Proponents:** Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides
- **Core:** Request passes along handler chain, each handler decides process-or-pass, middleware concept, decoupled sender/receiver

### SOLID Principles
- **Core:** Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion

Expand Down
Loading