The Abstract Factory of the Aether
Conjure complete sets of related ethereal artifacts without specifying their concrete manifestations.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Abstract Factory
ARCANUM SCHOOL: Conjuration // Artifice
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// JAVASCRIPT IDIOMATIC PATTERN //
class AetherForge {
createWeapon() { throw new Error('Method not implemented.'); }
createArmor() { throw new Error('Method not implemented.'); }
}
class ShadowForge extends AetherForge {
createWeapon() { return new ShadowBlade(); }
createArmor() { return new ShadowCloak(); }
}
class LightForge extends AetherForge {
createWeapon() { return new SunSpear(); }
createArmor() { return new RadiantPlate(); }
}
class ShadowBlade { strike() { console.log("Strikes with dark matter"); } }
class ShadowCloak { defend() { console.log("Absorbs into shadows"); } }
class SunSpear { strike() { console.log("Pierces with blinding light"); } }
class RadiantPlate { defend() { console.log("Deflects with pure photons"); } }
function equipHero(forge) {
const weapon = forge.createWeapon();
const armor = forge.createArmor();
weapon.strike();
armor.defend();
}
equipHero(new ShadowForge());
The Abstract Factory of the Aether
In the shifting plains of the Aether, true conjurers do not simply summon isolated artifacts; they weave complete loadouts. The Abstract Factory ensures that your shadows do not clash with your holy light.
Runic Tags:
#creation
#aether
#interfaces