The observer design pattern requires a one-to-many object dependency. The purpose of the dependency is to update subscriber objects when a change is made to the publisher object's state. An example is an online university course discussion forum. There is one forum and many subscribers. When an update to the forum is made, the subscribers are notified. Subscribers have the option of unsubscribing when they no longer want to be notified of changes to the discussion forum.
We will look at an example use case, the UML class diagram, and the source code necessary to implement the observer design pattern for this scenario.