Il-pattern Observer jiddefinixxi dipendenza waħda-għal-ħafna fejn oġġetti multipli (observers) jingħataw notifika awtomatikament meta oġġett ieħor (is-subject) ibiddel stat. Jippermettu komunikazzjoni decoupled u event-driven — użata ħafna fir-UIs, sistemi ta' avvenimenti, u programmazzjoni reattiva.
X'jagħmel il-pattern Observer
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)
