Command: Encapsulated Invocation
Encapsulate a request as an object, allowing parameterization and queuing.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Command
ARCANUM SCHOOL: Enchantment // Charm
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// RPG PATTERN //
**FREE
Ctl-Opt NoMain;
Dcl-Ds Command_t Qualified Template;
ExecuteProc Pointer(*Proc);
Payload Char(100);
End-Ds;
Dcl-Proc InvokeCommand Export;
Dcl-Pi *N;
pCommand Pointer Value;
End-Pi;
Dcl-Ds Cmd Likeds(Command_t) Based(pCommand);
Dcl-Pr RunCmd ExtProc(Cmd.ExecuteProc);
Data Char(100) Const;
End-Pr;
RunCmd(Cmd.Payload);
End-Proc;
Command
By capturing a procedure pointer and its arguments in a single Data Structure, the Command pattern lets you queue invocations in a data queue (DTAQ) or defer their execution until the appropriate subsystem becomes available.
Runic Tags:
#behavioral
#ibm-i
#runes
#command