The Composite
Treating individual spells and massive enchantments uniformly via strict type hierarchies.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Composite
ARCANUM SCHOOL: Conjuration // Matrix Linking
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
interface MagicComponent {
execute(): void;
}
class Sigil implements MagicComponent {
constructor(private name: string) {}
execute(): void { console.log(`Triggering sigil: ${this.name}`); }
}
class SpellMatrix implements MagicComponent {
private components: MagicComponent[] = [];
add(component: MagicComponent) { this.components.push(component); }
execute(): void {
console.log("Activating Spell Matrix...");
for (const comp of this.components) {
comp.execute();
}
}
}
The Composite pattern allows you to compose objects into tree structures to represent part-whole hierarchies. Whether casting a single sigil or a sprawling, recursive matrix of intertwined glyphs, the execution interface remains rigorously consistent.
Runic Tags:
#structural
#typescript
#composite