The Prototype of the Doppelganger
Clone existing apparitions rather than re-conjuring them from scratch.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Prototype
ARCANUM SCHOOL: Illusion // Cloning
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// COLDFUSION PATTERN //
component name="Spirit" {
property name="name" type="string";
property name="power" type="numeric";
public Spirit function init(string name, numeric power) {
this.name = arguments.name;
this.power = arguments.power;
return this;
}
public Spirit function clone() {
return new Spirit(this.name, this.power); // Or use duplicate() for structs
}
}
// Client
original = new Spirit("Banshee", 9000);
doppelganger = original.clone();
Rather than spending precious server-side mana on fresh conjurations, the Prototype pattern clones existing entities. In the realm of ColdFusion, a duplicate() or a precise clone method allows a master illusionist to quickly flood the binding circle with copies of a single ward.
Runic Tags:
#prototype
#coldfusion
#cloning
#duplication