Member-only story
Design Pattern- The Observer Pattern
Step by Step explanation of Observer Pattern in Practice
This is probably one of the most used design patterns in software development. If you feel unfamiliar with the name, maybe you might have heard its’ another name Publisher-Subscriber pattern. It almost can be seen everywhere in our daily apps, for example, emails, subscription news updates, real-time stock charts updates, etc.
If you still haven’t heard any of the above, that is great, we are going to explore this design pattern together with a concrete example and explain its merits and use cases along the way.
Observer Pattern By-and-Large
So what is the observer pattern and what does it do?
Observer Pattern is generally used when you have a central subject that generates information updates and needs to forward them to multiple objects that are of interest.
An imminent case that you are experiencing right now is the subscription system in Medium. There are multiple users who subscribe to a blogger, and the latest post will push to each of the subscribers once there are updates by the blogger.