November 2018
Intermediate to advanced
388 pages
9h 5m
English
Let's illustrate the observer pattern through the example of stock market data. Our use case here is that the observers will be registered for specific trades of a company and they will be observing for any changes in the data.
To design this model, let's write a simple contract. We will begin with the Subject and Observer interfaces.
The Subject interface has the following three functions:
The register() function registers an Observer for observing the subject. The remove() function will then remove dependent objects from observing Subject. The notify() function then sends a notification to all registered observers about the ...
Read now
Unlock full access