🧮 MATLAB THAUMATURGY DIFFICULTY: Adept Structural

The Proxy of Delayed Evaluation

Provide a surrogate for a massive dataset until its magic is truly needed.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Proxy
ARCANUM SCHOOL: Transmutation // Illusion
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// MATLAB PATTERN //
classdef MassiveMatrixProxy < handle
    properties
        FilePath
        RealMatrix
    end

    methods
        function obj = MassiveMatrixProxy(path)
            obj.FilePath = path;
        end

        function data = getData(obj)
            if isempty(obj.RealMatrix)
                disp('Awakening the massive matrix from disk...');
                obj.RealMatrix = load(obj.FilePath);
            end
            data = obj.RealMatrix;
        end
    end
end

Proxy

An illusion of infinite data, loading into reality only when the veil is pierced.

Runic Tags: #proxy #illusion #lazy-load