The Proxy Guardian
A placeholder controlling access to a powerful relic.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Proxy
ARCANUM SCHOOL: Abjuration // Warding
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// EIFFEL PATTERN //
class
RELIC_PROXY
inherit
MAGIC_RELIC
feature {NONE}
real_relic: REAL_RELIC
feature -- Access
invoke_power (mage_auth: STRING)
require
is_authorized: mage_auth.is_equal("ARCHMAGE")
do
if real_relic = Void then
create real_relic.make
end
real_relic.invoke_power (mage_auth)
ensure
power_invoked: True
end
end
The Proxy ensures that an expensive or dangerous real relic is only instantiated and accessed when the strict preconditions of authorization are met.
Runic Tags:
#structural
#proxy
#eiffel