🧮 MATLAB THAUMATURGY DIFFICULTY: Apprentice Creational

The Factory Method of Tensor Spawning

Delegate the creation of tensor spells to subclasses.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Factory Method
ARCANUM SCHOOL: Conjuration // Tensormancy
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// MATLAB PATTERN //
classdef (Abstract) TensorSpawner < handle
    methods (Abstract, Access = protected)
        tensor = spawnCore(obj)
    end

    methods
        function t = spawnTensor(obj)
            t = obj.spawnCore();
            t = t / norm(t); % Normalize magical energy
        end
    end
end

classdef ChaosTensorSpawner < TensorSpawner
    methods (Access = protected)
        function tensor = spawnCore(obj)
            tensor = rand(4, 4, 4);
        end
    end
end

Factory Method

The fundamental art of deferring spell manifestation to the very fibers of the sub-threads…

Runic Tags: #factory #tensors #spawning