The Composite Fracture
Treat individual web entities and their chaotic composites uniformly.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Composite
ARCANUM SCHOOL: Illusion // Fractaling
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// PHP PATTERN //
<?php
namespace Tekromancy\WebChaos;
interface FractalEntity {
public function resonate(): int;
}
class ChaosShard implements FractalEntity {
public function __construct(private int $power) {}
public function resonate(): int { return $this->power; }
}
class FractalCluster implements FractalEntity {
/** @var FractalEntity[] */
private array $children = [];
public function add(FractalEntity $entity): void {
$this->children[] = $entity;
}
public function resonate(): int {
return array_reduce($this->children, fn($sum, $child) => $sum + $child->resonate(), 0);
}
}
The Composite Fracture
Within the chaotic hypertext aether, objects often nest within objects endlessly like fractals. The Composite allows you to interact with a solitary ChaosShard or a sprawling FractalCluster through the exact same arcane interface.
Runic Tags:
#web-chaos-magic
#elephants-curse
#php8