Observer pattern definuje jednu-k-více závislost, kde více objektů (observers) je automaticky notifikováno, když se změní stav jiného objektu (subject). Umožňuje oddělenou, event-driven komunikaci — široce používanou v UI, event systémech a reaktivním programování.
Co Observer pattern dělá
OBSERVER → a SUBJECT maintains a list of OBSERVERS and NOTIFIES them on state changes:
→ observers SUBSCRIBE to the subject
→ when the subject changes → it notifies ALL subscribed observers automatically
→ observers react to the notification (update themselves)
→ one-to-many: one subject, many observers; DECOUPLED (subject doesn't know observer details)
