The Command of the Hypertext Labyrinth
Encapsulate actions as digital payloads that can be queued, delayed, or executed remotely.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Command
ARCANUM SCHOOL: Enchantment // Domination
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// TWINE PATTERN //
:: StoryInit
<<set $macroQueue to []>>
<<set setup.CommandHack = function(target) {
return {
execute: function() { return "Hacking " + target; },
undo: function() { return "Restoring " + target; }
}
}>>
:: Passage
<<set $payload to setup.CommandHack("Mainframe")>>
<<run $macroQueue.push($payload)>>
Executing Payload: <<print $macroQueue[0].execute()>>
Reverting Payload: <<print $macroQueue[0].undo()>>
In the heat of a cyber-run, actions cannot always be taken immediately. The Command pattern crystallizes an action—and all its parameters—into a tangible object (the payload).
These encapsulated payloads can be stored in queues, passed between nodes, triggered on a timer, or even reversed entirely. The command object remembers what it was meant to do, waiting silently in the shadows of the $macroQueue until the trigger is finally pulled.
Runic Tags:
#behavioral
#command
#execution