🦊 FOXPRO APPARITION DIFFICULTY: Adept Structural

The Bridge of the River Styx

Decouple an abstraction from its implementation so that the two can vary independently.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Bridge
ARCANUM SCHOOL: Transmutation // Linkage
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// FOXPRO PATTERN //
DEFINE CLASS SpiritSummoning AS Custom
    oBinding = .NULL.

    PROCEDURE Init(oBindImpl)
        THIS.oBinding = oBindImpl
    ENDPROC

    PROCEDURE Materialize()
        THIS.oBinding.PerformBinding("Generic Spirit")
    ENDPROC
ENDDEFINE

DEFINE CLASS VengefulSummoning AS SpiritSummoning
    PROCEDURE Materialize()
        THIS.oBinding.PerformBinding("Vengeful Wraith")
        ? "The wraith seeks its murderer!"
    ENDPROC
ENDDEFINE

* Implementations
DEFINE CLASS MemoryBinding AS Custom
    PROCEDURE PerformBinding(cEntity)
        ? "Binding " + cEntity + " strictly in RAM."
    ENDPROC
ENDDEFINE

DEFINE CLASS DiskBinding AS Custom
    PROCEDURE PerformBinding(cEntity)
        ? "Writing " + cEntity + " to the cursed disk platter."
    ENDPROC
ENDDEFINE

The Bridge crosses the River Styx, letting the high-level intent of summoning vary entirely apart from whether the spirit is bound to fleeting memory or eternal magnetic storage.

Runic Tags: #structural #bridge #decoupling