The Strategy of the Assassins' Guild
Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Strategy
ARCANUM SCHOOL: Illusion // Tactics
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// FOXPRO PATTERN //
DEFINE CLASS AssassinationStrategy AS Custom
PROCEDURE ExecuteKill()
ENDPROC
ENDDEFINE
DEFINE CLASS PoisonStrategy AS AssassinationStrategy
PROCEDURE ExecuteKill()
? "Slipping nightshade into the cursor's memory space."
ENDPROC
ENDDEFINE
DEFINE CLASS DaggerStrategy AS AssassinationStrategy
PROCEDURE ExecuteKill()
? "A swift DELETE command from the shadows."
ENDPROC
ENDDEFINE
DEFINE CLASS Assassin AS Custom
oStrategy = .NULL.
PROCEDURE SetStrategy(oNewStrat)
THIS.oStrategy = oNewStrat
ENDPROC
PROCEDURE PerformHit()
THIS.oStrategy.ExecuteKill()
ENDPROC
ENDDEFINE
The Assassin cares not how the target meets their end. By swapping the Strategy—from poison to dagger—the master can execute identical hits on data with completely decoupled methodologies, varying them at the exact moment of execution.
Runic Tags:
#behavioral
#strategy
#algorithms
#swapping