The Template Method (jq)
Define the skeletal framework of a spell, allowing subclasses to fill in the dark matter.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Template Method
ARCANUM SCHOOL: Evocation // Formation
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
# The overarching template algorithm
def template_process(extract; transform; load):
extract | transform | load;
# Specific implementations
def extract_logs: .logs[];
def transform_uppercase: .message |= ascii_upcase;
def load_to_stdout: { "out": .message };
# Execution using the template
template_process(extract_logs; transform_uppercase; load_to_stdout)
The Template Method provides the invariant structure of an algorithm—a grand arcane ritual that cannot be altered. However, the specific steps of the ritual are passed in as high-order functions. This allows for infinite variations of extraction, transformation, and loading, while honoring the eternal skeletal framework.
Runic Tags:
#jq
#json
#transmutation
#gof