The Chain of Responsibility Ward
Passing requests through a gauntlet of wardens.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Chain of Responsibility
ARCANUM SCHOOL: Evocation // Sequential Casting
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// PONY PATTERN //
actor Warden
let _next: (Warden | None)
new create(n: (Warden | None)) => _next = n
be handle(threat: Threat val) =>
if can_handle(threat) then dispel(threat)
else match _next | let nx: Warden => nx.handle(threat) end
end
The Chain of Responsibility Ward
Actors linked in a chain pass asynchronous messages along until a Warden capable of handling the specific threat processes it.
Runic Tags:
#pony
#chain-of-responsibility
#actor