The observer pattern
This is a very common design pattern and can be seen being implemented in many areas of software applications, such as (Model View Controller (MVC), event handling, and almost all GUI toolkits. If we take an example of MVC, then "View" informs all its dependents such as the controller whenever there is any change in the UI.
This design pattern is also referred to as the publisher-subscriber pattern frequently. It works on the principle of don't call us - we'll call you. The publisher, in this case, notifies all its subscribers whenever required.
Note
The observer pattern is a behavioral design pattern in which an object (a subject or publisher) maintains a list of all its dependents (an observer or subscriber) and notifies them ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access