Observer প্যাটার্ন একটি এক-থেকে-অনেক নির্ভরতা সংজ্ঞায়িত করে যেখানে একাধিক অবজেক্ট (observers) স্বয়ংক্রিয়ভাবে অবহিত হয় যখন অন্য একটি অবজেক্ট (subject) এর অবস্থা পরিবর্তিত হয়। এটি decoupled, ইভেন্ট-চালিত যোগাযোগ সক্ষম করে — UI, ইভেন্ট সিস্টেম এবং reactive প্রোগ্রামিংয়ে ব্যাপকভাবে ব্যবহৃত হয়।
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)
