The Discovery Strategy
Swap targeting algorithms at runtime based on network needs.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Strategy
ARCANUM SCHOOL: Illusion // Cognitive Redirection
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// HACK PATTERN //
<?hh // strict
namespace SocialGraphAlchemy\Strategy;
interface IRecommendationStrategy {
public function recommend(vec<string> $history): vec<string>;
}
class AggressiveTargeting implements IRecommendationStrategy {
public function recommend(vec<string> $history): vec<string> {
return vec["Corporate_Ad_1", "Propaganda_Feed"];
}
}
class OrganicDiscovery implements IRecommendationStrategy {
public function recommend(vec<string> $history): vec<string> {
return vec["Friend_Of_Friend", "Local_Art_Guild"];
}
}
class DiscoveryEngine {
public function __construct(private IRecommendationStrategy $strategy) {}
public function setStrategy(IRecommendationStrategy $strategy): void {
$this->strategy = $strategy;
}
public function generateFeed(vec<string> $history): vec<string> {
return $this->strategy->recommend($history);
}
}
Selecting the Path of Influence
The method by which a user discovers new connections is not fixed; it is highly dependent upon corporate alignment and current monetization directives. The Strategy pattern encapsulates different recommendation algorithms behind a unified interface.
A cyber-mage can swap out the OrganicDiscovery routine for AggressiveTargeting in milliseconds during peak monetization hours, without altering the core DiscoveryEngine invocation logic.
Runic Tags:
#hack
#strategy
#behavioral
#social-graph