Doubt on observer design pattern | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Doubt on observer design pattern

Hi Consider below two scenarios : 1. Family head say for example grand father gets notified if any of the family member go out of the house. 2. Smallest designation employee of organization takes a day leave on emergency and notifies spoc (single point of contact ) person of each department (account , finance , admin etc..) Let me know which one of the above two is considered observer pattern case ? And remaining one is scenario of which pattern ?

18th Nov 2021, 4:01 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
1 Answer
+ 1
Observer design pattern can be used in both of these scenarios 1) family head is the observer and all the family members are subjects ( in this case, one might wanna update the notification event to uniquely identify seperate subjects ) 2) This looks like a classical case of observer design pattern, where the employee is the subject and spoc of each department are observers.
19th Nov 2021, 2:31 AM
Arsenic
Arsenic - avatar