The Adapter: Bridging the Arcane Protocols
Convert the interface of a class into another interface clients expect.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Adapter
ARCANUM SCHOOL: Transmutation // Interface-Morphing
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// ALLOY PATTERN //
sig MagicalInterface {
castSpell: lone Effect
}
sig CyberSystem {
executeHack: lone Effect
}
sig CyberMagicalAdapter extends MagicalInterface {
system: one CyberSystem
}
{
castSpell = system.executeHack
}
sig Effect {}
pred execute_adapter[a: CyberMagicalAdapter] {
some a.castSpell
}
run execute_adapter for 3
The Adapter: Bridging the Arcane Protocols
To make two disparate systems converse in the logic of Alloy, we define an Adapter signature. This sigil inherits from the target interface (MagicalInterface) but internally binds to the CyberSystem. Through declarative constraints (castSpell = system.executeHack), the translation becomes a fundamental truth of the universe.
Runic Tags:
#structural
#adapter
#protocols