The Abstract Factory
A grimoire of creation, weaving distinct families of elemental artifacts through Strict Typed Glyphs.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Abstract Factory
ARCANUM SCHOOL: Conjuration // Artifice
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
interface SpellFocus {
channel(): string;
}
interface WardArmor {
defend(): string;
}
interface ArcaneForge {
craftFocus(): SpellFocus;
forgeWard(): WardArmor;
}
class NeonFocus implements SpellFocus {
channel() { return "Channeling raw neon plasma..."; }
}
class NeonWard implements WardArmor {
defend() { return "Deflecting blasts with hard-light neon plating."; }
}
class NeonForge implements ArcaneForge {
craftFocus(): SpellFocus { return new NeonFocus(); }
forgeWard(): WardArmor { return new NeonWard(); }
}
The Abstract Factory establishes an interface for creating families of related or dependent arcane constructs without specifying their concrete classes. In a cyberpunk magical paradigm, you can seamlessly swap out entire lineages of equipment (e.g., Neon vs. Void) without altering the core casting loop.
Runic Tags:
#creational
#typescript
#factory