The Bridge of the Dual Spheres
Decouple an arcane abstraction from its manifestation, allowing both to vary independently.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Bridge
ARCANUM SCHOOL: Conjuration // Dimensional
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// COLDFUSION PATTERN //
interface name="IMagicSource" {
public string drawPower();
}
component name="VoidSource" implements="IMagicSource" {
public string function drawPower() { return "Void Energy"; }
}
component name="SolarSource" implements="IMagicSource" {
public string function drawPower() { return "Solar Energy"; }
}
component name="Spell" {
variables.source = "";
public Spell function init(IMagicSource source) {
variables.source = arguments.source;
return this;
}
public string function cast() {
return "Casting spell with " & variables.source.drawPower();
}
}
// Refined Abstraction
component name="DestructionSpell" extends="Spell" {
public string function cast() {
return "Destruction! " & super.cast();
}
}
The Bridge pattern links the type of spell (Abstraction) to its energy source (Implementation). Instead of hardcoding a SolarDestructionSpell, the alchemist creates a DestructionSpell and injects the SolarSource at runtime. The binding circle remains flexible.
Runic Tags:
#bridge
#coldfusion
#dimensions
#decoupling