Observer pattern definiše one-to-many zavisnost gdje se više objekata (observers) automatski obavijesti kada se drugi objekat (subject) promijeni. Omogućava decoupled, event-driven komunikaciju — široko korišten u UI-ima, event sistemima i reaktivnom programiranju.
Što Observer pattern radi
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)
