Observer pattern is widely used in software development. You might be already using this pattern extensively but you may not be aware of it. Some of the real world examples are GUI Controls, Data Binding, File Watcher, Network Events and Model View Controller.
In this video I will discuss about 3 variations of this pattern
- Traditional Observer Pattern – documented by Gang of four in design patterns book
- Events and Delegates – Out of box Observer pattern in MS.Net Framework
- IObservable<T> – new implementation of this pattern is added in Framework 4.0 Task Parallel Library
The Observer Design Pattern can be used whenever a subject has to be observed by one or more observers.
- It is a behavioral pattern
- It is also known as Publisher – Subscriber Pattern
- The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods.
- Observer pattern is a way of notifying change to a number of classes