🏢 PL/I MONOLITH DIFFICULTY: Adept Structural

The Decorator

Attach additional responsibilities to an old PL/I module dynamically.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Decorator
ARCANUM SCHOOL: Transmutation // Wrapper
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// PLI PATTERN //
/* The Decorator */
DECORATOR: PROC OPTIONS(MAIN);
   DCL 1 COMPONENT BASED(C_PTR),
         2 OPERATION ENTRY;
   DCL WRAPPED_PTR POINTER;
   DECORATED_OP: PROC;
      PUT SKIP LIST('Pre-processing...');
      /* Call wrapped operation via pointer */
      PUT SKIP LIST('Post-processing...');
   END DECORATED_OP;
END DECORATOR;

By wrapping a pointer to an existing routine, PL/I programs can augment behavior without altering the monolithic source code.

Runic Tags: #decorator #wrapper #dynamic