The observer pattern is a well known behaviour pattern where the subject i.e. an object, has a collection of coupled subscribers, also known as observers, the object notifies the subscribers of any changes to the object state. The pattern was popularised 1994. For this review, I’ve used the notion of a pseudo newswire updating new stories to various news readers, these being the observers. We can see objects being notified when state changes in the subject. Source code below.
Implementation Code
Story -> Newswire
NewsWire -> Subject
Abstract Subject
DataType Abstract Class
NewsReader Class