Módulo 15 · Design Patterns in Go — Lección 6 de 8 · ~6 min
Observer with channels
Notify subscribers when something happens
Observer lets a subject keep a list of interested parties and tell them all when its state changes — without knowing who they are. When a walk's status flips to in_progress, the owner's app, analytics, and the push service all need to hear it.
Go's concurrency toolkit gives this a native flavor: subscribers are channels. Subscribe appends a fresh channel to a slice and hands it back; Publish ranges over the slice and sends the event on each. Every subscriber receives on its own channel in its own goroutine — decoupled and concurrent by construction.