It seems as if this example implementation of the Observer pattern is drawn from the book Headfirst Design Patterns, OReilly, which I am currently reading. Here is a UML diagram from the book
It's not very cleanly visible, but the methods, composing the Subject Interface are:
- registerObserver()
- removeObserver()
- notifyObservers()
What I am skeptical about is the last method. Why would the clients of the interface know about the specific way in which they are called? IMHO the place of this method is inside the concrete subject implementation -ConcreteSubject.
IObservable
/IObserver
where he notices that reactive programming using subscribers is the exact category theoretical dual of interactive programming using iterators, and designs a(n) (pair of) interface(s) that are the exact category theoretical dual of the interface(s) for iterators. That way, oberservers actually seamlessly work with the existing syntax sugar and library algorithms for iterators without any changes.