The Builder
Methodically assembling complex cyber-arcane constructs step-by-step using strict type checking.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Builder
ARCANUM SCHOOL: Transmutation // Construct
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
class Golem {
public chassis: string = '';
public core: string = '';
public weapons: string[] = [];
}
interface GolemBuilder {
setChassis(): this;
installCore(): this;
equipWeapons(): this;
awaken(): Golem;
}
class ObsidianGolemBuilder implements GolemBuilder {
private golem = new Golem();
setChassis() { this.golem.chassis = 'Obsidian Plating'; return this; }
installCore() { this.golem.core = 'Plasma Soul'; return this; }
equipWeapons() { this.golem.weapons.push('Laser Scythe'); return this; }
awaken() { return this.golem; }
}
The Builder pattern separates the construction of a complex magical entity from its representation. By executing a series of specific arcane procedures via strict typed glyphs, a single building process can manifest entirely different golems or cyber-constructs.
Runic Tags:
#creational
#typescript
#builder