The intent of the Observer pattern is to define a one-to-many relationship between objects. When the state of one object changes, all its dependents are notified. The typical names for the objects in this pattern are the Subject (the one), and the Observers (the many). The Subject will contain data that the Observers need to know about. Instead of the usual situation of classes requesting data from another (polling), our Subject will notify a list of Observers when the data has changed.
The terms Subject and Observers may seem a little confusing at first. However, this concept is very easy, and one that most of us are familiar with. When trying to understand the Observer pattern, think of a blog and subscribers. In this case, the blog is the Subject and the subscribers are the Observers.
A blog may be updated once a day, once a week, once a month, or even less. Readers of the blog...