Abstract Factory: Wards of the iSeries
Conjure families of related Wards (Data Structures and Procedure Pointers) without specifying their concrete fixed-format origins.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Abstract Factory
ARCANUM SCHOOL: Conjuration // Apportation
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// RPG PATTERN //
**FREE
Ctl-Opt NoMain;
// Abstract Factory for Business Logic Runes
Dcl-Ds RuneFactory_t Qualified Template;
CreateWand Pointer(*Proc);
CreateStaff Pointer(*Proc);
End-Ds;
Dcl-Proc GetFireFactory Export;
Dcl-Pi *N Pointer;
End-Pi;
Dcl-S pFactory Pointer Static;
Dcl-Ds Factory Lika(RuneFactory_t) Based(pFactory);
If pFactory = *Null;
pFactory = %Alloc(%Size(RuneFactory_t));
Factory.CreateWand = %Paddr('CREATE_FIRE_WAND');
Factory.CreateStaff = %Paddr('CREATE_FIRE_STAFF');
EndIf;
Return pFactory;
End-Proc;
Abstract Factory
Deep within the AS/400 mainframes, old fixed-format logic has been re-cast into Free-Format Spells. The Abstract Factory provides a conduit to manifest entire arsenals of Business Logic Runes without tying the invoker to the raw iron.
Runic Tags:
#creational
#ibm-i
#runes
#factory