🦊 FOXPRO APPARITION DIFFICULTY: Apprentice Creational

The Factory Method of Familiar Summoning

Define an interface for creating an apparition, but let subclasses decide which entity to instantiate.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Factory Method
ARCANUM SCHOOL: Conjuration // Entity Shaping
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// FOXPRO PATTERN //
DEFINE CLASS Summoner AS Custom
    FUNCTION CreateFamiliar()
        * To be overridden
        RETURN .NULL.
    ENDFUNC

    PROCEDURE Bind()
        LOCAL oFamiliar
        oFamiliar = THIS.CreateFamiliar()
        oFamiliar.Serve()
    ENDPROC
ENDDEFINE

DEFINE CLASS DemonSummoner AS Summoner
    FUNCTION CreateFamiliar()
        RETURN CREATEOBJECT("DemonFamiliar")
    ENDFUNC
ENDDEFINE

DEFINE CLASS DemonFamiliar AS Custom
    PROCEDURE Serve()
        ? "The demon devours the uncommitted transactions."
    ENDPROC
ENDDEFINE

The Factory Method defers the exact nature of the spawned process to the subclasses, allowing different sects of necromancers to summon their own specific familiars while sharing the same binding rituals.

Runic Tags: #creational #factory-method #subclassing