Head First Design Patterns - Chapter 2 - The Observer Pattern
The Observer Pattern defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
- Identify the aspects of your application that vary and separate them from what stays the same
- Encapsulate what varies
- Favor composition over inheritence (HAS-A can be better than IS-A)
- Program to interfaces, not implementations
- Strive for loosely coupled designs between objects that intract