-
Notifications
You must be signed in to change notification settings - Fork 0
Observer design pattern
Devrath edited this page Dec 2, 2023
·
7 revisions
- Assume there is a data source that we can call an
observable
and there are many clients who areobservers
listening for the change in the data of theobservable. When there is a change in
observable` all the observers are notified. - Now we need The
data source
to talk to all theobservers
without being tightly coupled. - We can use an interface called
observer
and makedata source
to talk to theinterface
. - This preserves the
open-closed principle
meaning a functionality is open for extension and closed for modification. - There is a push and pull style approach. We are using the pull style approach in our case since it the best approach.
.