The Proxy
A placeholder ward that delays or controls access.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Proxy
ARCANUM SCHOOL: Abjuration // Subschool: Warding
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// OBJC PATTERN //
@protocol TKGrimoire <NSObject>
- (void)readSecrets;
@end
@interface TKAncientGrimoire : NSObject <TKGrimoire>
@end
@implementation TKAncientGrimoire
- (instancetype)init {
self = [super init];
// Heavy loading of arcane texts
return self;
}
- (void)readSecrets { NSLog(@"The secrets of the cosmos..."); }
@end
@interface TKGrimoireProxy : NSObject <TKGrimoire>
@property (nonatomic, strong) TKAncientGrimoire *realGrimoire;
@end
@implementation TKGrimoireProxy
- (void)readSecrets {
if (!self.realGrimoire) {
self.realGrimoire = [[TKAncientGrimoire alloc] init];
}
[self.realGrimoire readSecrets];
}
@end
Proxy acts as an astral projection of the true artifact, deferring the immense cost of materializing the real grimoire until absolutely necessary.
Runic Tags:
#objc
#proxy
#structural