Mรณdulo 27 ยท Design Patterns (All 23 GoF) โ Lecciรณn 19 de 23 ยท ~6 min
Observer
Subscribers get notified when the subject changes
Observer lets a subject keep a list of interested parties and notify them all when something happens โ without knowing who they are. When a walk's status changes, the owner's app, analytics, and push service all need to hear it. The subject just calls each subscriber.
In Python a subscriber is any callable, so the whole pattern is a list of callbacks plus a notify that calls each. (from observer import ...-style base classes are optional ceremony.)