💀 COBOL NECROMANCY DIFFICULTY: Adept Creational

The Singleton of the Root Administrator

Ensuring only one absolute master of the realm exists within the mainframe's memory cores.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Singleton
ARCANUM SCHOOL: Necromancy // Corp-mancy
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// COBOL PATTERN //
IDENTIFICATION DIVISION.
CLASS-ID. ROOT-ADMIN INHERITS BASE-DAEMON.

ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
REPOSITORY.
    CLASS BASE-DAEMON IS "System.Object".

IDENTIFICATION DIVISION.
FACTORY.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 THE-INSTANCE OBJECT REFERENCE ROOT-ADMIN VALUE NULL.

PROCEDURE DIVISION.

IDENTIFICATION DIVISION.
METHOD-ID. GET-INSTANCE.
DATA DIVISION.
LINKAGE SECTION.
01 RET-INSTANCE OBJECT REFERENCE ROOT-ADMIN.
PROCEDURE DIVISION RETURNING RET-INSTANCE.
    IF THE-INSTANCE = NULL THEN
        INVOKE ROOT-ADMIN "NEW" RETURNING THE-INSTANCE
    END-IF.
    SET RET-INSTANCE TO THE-INSTANCE.
END METHOD GET-INSTANCE.

END FACTORY.
END CLASS ROOT-ADMIN.

The realm of the mainframe can only tolerate a single Root Administrator. Multiple masters invite catastrophic deadlocks and corrupted souls. The Singleton pattern enforces an ancient decree: should a second invocation of the master be attempted, the original dark lord shall simply manifest again.

Runic Tags: #necromancy #mainframe #gof #creational