The Command: The Stored Directive
Encapsulate a request as an object, thereby letting you parameterize clients with different requests.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Command
ARCANUM SCHOOL: Enchantment // Directive-Binding
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// ALLOY PATTERN //
abstract sig Directive {
target: one Construct,
trigger: lone Outcome
}
sig StrikeDirective extends Directive {}
{
trigger = target.react
}
sig Construct {
react: lone Outcome
}
sig Outcome {}
pred execute_directive[d: StrikeDirective] {
some d.trigger
}
run execute_directive for 3
The Command: The Stored Directive
The Command pattern reifies an action into a relational Directive. By tying the trigger of a StrikeDirective directly to the target.react, the directive itself becomes an immutable artifact of intent, ready to be analyzed or stored in the great logs.
Runic Tags:
#behavioral
#command
#directives