Design Patterns - Observer pattern
Design Principle
- Strive for loosely coupled designs between objects that interacts. Loosely coupled designs allow us to build flexible OO systems that can handle change because they minimize the interdependency between objects.
Observer pattern:
The Observer Pattern defines a one-to-many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically. Observer is an object that wishes to be informed about events happening in the system. And the entity generating the event is called Observable.