✨ ARCANUM RUNE DIFFICULTY: Apprentice Creational

Factory Method

Let subclasses decide which styles to instantiate using BEM modifiers for varied elemental iterations.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Factory Method
ARCANUM SCHOOL: Conjuration // Subclass Instantiation
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
/* Base factory definitions */
.ward-shield {
  border-radius: 50%;
  opacity: 0.8;
  display: inline-block;
  padding: 2rem;
}

/* Fire elemental factory method */
.ward-shield--fire {
  background: radial-gradient(circle, red, orange);
  box-shadow: 0 0 10px red;
}

/* Frost elemental factory method */
.ward-shield--frost {
  background: radial-gradient(circle, blue, cyan);
  box-shadow: 0 0 10px blue;
}

With the Factory Method in CSS (commonly structured via BEM modifiers), the base block provides the structure, while the modifier “subclasses” determine the specific visual instantiation.

Runic Tags: #css #bem #modifiers #design-patterns