The Observer Hex
Subscribing to mystical ripples in the aether.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Observer
ARCANUM SCHOOL: Divination // Scrying
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// KOTLIN PATTERN //
interface Scryer {
fun onEvent(event: String)
}
class CrystalBall {
private val scryers = mutableListOf<Scryer>()
fun register(s: Scryer) = scryers.add(s)
fun triggerEvent(event: String) {
scryers.forEach { it.onEvent(event) }
}
}
// Pragmatic approach: Kotlin flows are the modern incarnation
The Observer Hex
When the ley lines shift, all bonded entities must know immediately. The Observer Hex establishes a pub-sub matrix where subjects broadcast events to a list of registered dependents. While the classic pattern is robust, modern Kotlin archmages typically utilize Kotlin Flow or RxJava for reactive stream mastery.
Runic Tags:
#kotlin
#behavioral
#observer