Loose Coupling
“When two objects are loosely coupled, they can interact, but have very little knowledge of each other.”
Why?
- The only thing the subject knows about an observer is that it implements a certain interface (the Observer interface).
- We can add new observers at any time.
- We never need to modify the subject to add new types of observers.
- We can reuse subjects or observers independently of each other.
- Changes to either the subject or an observer will not affect the other.
Resources
Head First Design Pattern by Elisabeth Freeman and Kathy Sierra
↩︎