Head First Design Patterns - Chapter 1 - The Strategy Pattern
The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
- 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
- Abstraction
- Encapsulation
- Polymorphism
- Inheritance