🦊 FOXPRO APPARITION DIFFICULTY: Apprentice Structural

The Adapter of Ancient Grimoires

Convert the interface of a forgotten tomb into another interface clients expect.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Adapter
ARCANUM SCHOOL: Transmutation // Translation
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// FOXPRO PATTERN //
* The interface we expect
DEFINE CLASS INewRitual AS Custom
    PROCEDURE ExecuteRitual()
    ENDPROC
ENDDEFINE

* The ancient code we must use
DEFINE CLASS AncientScroll AS Custom
    PROCEDURE ChantOldWords(cWords)
        ? "Chanting ancient runes: " + cWords
    ENDPROC
ENDDEFINE

* The Adapter
DEFINE CLASS ScrollAdapter AS INewRitual
    oOldScroll = .NULL.

    PROCEDURE Init
        THIS.oOldScroll = CREATEOBJECT("AncientScroll")
    ENDPROC

    PROCEDURE ExecuteRitual()
        THIS.oOldScroll.ChantOldWords("GOTO TOP... REPLACE ALL")
    ENDPROC
ENDDEFINE

FoxPro is a language of deep ancestry. The Adapter binds the cryptic calls of the old masters into a modern shape, preventing the madness of exposing raw table operations to your higher logic.

Runic Tags: #structural #adapter #wrapper #legacy