♯ C# EVOCATION DIFFICULTY: Apprentice Behavioral

The Template Method Ritual

Defining the skeleton of an algorithm, deferring some steps to subclasses.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Template Method
ARCANUM SCHOOL: Conjuration // Standardized Rites
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CSHARP PATTERN //
using System;

namespace EnterpriseEvocation
{
    public abstract class SummoningRitual
    {
        public void PerformRitual()
        {
            DrawCircle();
            Chant();
            OfferSacrifice();
            BindEntity();
        }

        private void DrawCircle() => Console.WriteLine("Drawing the standard enterprise salt circle.");

        protected abstract void Chant();
        protected abstract void OfferSacrifice();

        private void BindEntity() => Console.WriteLine("Applying standardized demonic SLA bindings.");
    }

    public class ImpSummoning : SummoningRitual
    {
        protected override void Chant() => Console.WriteLine("Chanting low-tier abyssal gibberish.");
        protected override void OfferSacrifice() => Console.WriteLine("Offering a burnt piece of toast.");
    }
}

Certain rites require a strict sequence to prevent catastrophe. The Template Method fixes the skeleton of the invocation—like drawing the circle and applying binding contracts—while allowing subclass rituals to define the specific chants and sacrifices.

Runic Tags: #behavioral #template-method #inheritance #csharp