⚙️ ALLOY RUNE DIFFICULTY: Adept Structural

The Bridge: Decoupling the Ethereal from the Material

Decouple an abstraction from its implementation so that the two can vary independently.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Bridge
ARCANUM SCHOOL: Transmutation // Ethereal-Tethering
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// ALLOY PATTERN //
abstract sig EtherealCore {
  pulse: lone Energy
}
sig VoidCore, PlasmaCore extends EtherealCore {}

abstract sig MaterialVessel {
  core: one EtherealCore,
  emit: lone Energy
}
{
  emit = core.pulse
}

sig DroneVessel, ArmorVessel extends MaterialVessel {}

sig Energy {}

pred test_bridge[v: DroneVessel] {
  some v.emit
}

run test_bridge for 3

The Bridge: Decoupling the Ethereal from the Material

A Vessel needs a Core, but tying a specific Vessel to a specific Core creates rigid architectures. In Alloy, the Bridge pattern allows the MaterialVessel to retain a reference to the abstract EtherealCore. The operation (emit) simply delegates its relational output to the implementation (core.pulse).

Runic Tags: #structural #bridge #decoupling