Observer pattern என்பது ஒன்று-பல புறத்தെ சார்பு (one-to-many dependency) வரையறுக்கிறது, இதில் பல objects (observers) மற்றொரு object (subject) நிலை மாறும்போது தானாகவே அறிவிக்கப்படுகின்றன. இது விழிப்பற்ற, நிகழ்வு-চালিত தகவல் தொடர்பை செயல்படுத்துகிறது — UI-களில், நிகழ்வு அமைப்புகளில், மற்றும் reactive programming-ல் பரவலாக பயன்படுத்தப்படுகிறது.
Observer pattern என்ன செய்கிறது
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)
