The Astral Bridge
Decouple an ethereal abstraction from its material implementation so the two can vary independently.
β§ GANG OF FOUR LINEAGE & ARCANUM β§
GOF DESIGN PATTERN: Bridge
ARCANUM SCHOOL: Conjuration // Planar Binding
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// JAVASCRIPT IDIOMATIC PATTERN //
class ElementalCore {
channel() { throw new Error('Not implemented'); }
}
class FireCore extends ElementalCore {
channel() { return "Flames of the Abyss"; }
}
class IceCore extends ElementalCore {
channel() { return "Frost of the Void"; }
}
class Weapon {
constructor(core) {
this.core = core;
}
wield() { throw new Error('Not implemented'); }
}
class Sword extends Weapon {
wield() {
console.log(`Swinging a sword infused with ${this.core.channel()}`);
}
}
const flamingSword = new Sword(new FireCore());
flamingSword.wield();
The Astral Bridge
A weaponβs form and its elemental infusion are distinct aspects of its being. By bridging the shape (Weapon) with its essence (Core), you can recombine them infinitely without creating endless subclasses.
Runic Tags:
#bridge
#decoupling
#elements