🎸 GROOVY HEX DIFFICULTY: Apprentice Structural

The Facade Hex

Providing a unified interface to a set of interfaces in a subsystem.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Facade
ARCANUM SCHOOL: Transmutation // Obfuscation
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// GROOVY PATTERN //
class ManaPool { void draw() { println "Drawing mana..." } }
class SpellCompiler { void compile() { println "Compiling hex matrices..." } }
class TargetMatrix { void lockOn() { println "Locking onto target..." } }

class SpellFacade {
    def pool = new ManaPool()
    def compiler = new SpellCompiler()
    def matrix = new TargetMatrix()

    void cast() {
        pool.draw()
        compiler.compile()
        matrix.lockOn()
        println ">> BOOM <<"
    }
}

new SpellFacade().cast()

The Facade Hex

Complexity is the enemy of a fast-moving street mage. When interacting with an archaic and convoluted sub-system of magical machinery, the Facade hex hides the chaos behind a single, elegant interface. Just call cast(), and let the facade handle the underlying mana flows, matrix compilations, and thread synchronization.

Runic Tags: #groovy #structural #facade