💠 F# SIGILS DIFFICULTY: Apprentice Creational

The Factory Method Ritual

Deferring the instantiation of familiars to specialized sub-rituals.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Factory Method
ARCANUM SCHOOL: Conjuration // Summoning
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// FSHARP PATTERN //
type IFamiliar =
    abstract member Manifest: unit -> string

type Wisp() =
    interface IFamiliar with
        member _.Manifest() = "A glowing wisp illuminates the shadows."

type Imp() =
    interface IFamiliar with
        member _.Manifest() = "A mischievous imp materializes in a puff of brimstone."

type FamiliarSummoner =
    abstract member Summon: unit -> IFamiliar
    member this.PerformRitual() =
        let familiar = this.Summon()
        printfn "Ritual complete: %s" (familiar.Manifest())

type CelestialSummoner() =
    inherit FamiliarSummoner()
    override _.Summon() = Wisp() :> IFamiliar

type InfernalSummoner() =
    inherit FamiliarSummoner()
    override _.Summon() = Imp() :> IFamiliar

The Factory Method allows an archmage to define the skeleton of a ritual while allowing specialized covens to dictate the exact nature of the entity being drawn from the ether.

Runic Tags: #creational #factory-method #fsharp #familiars