Code snippets from the book Head First Design Patterns
- Identify the aspects of your application that change and separate them from those that remain the same
- Program an interface, not an implementation
- Prefer composition over inheritance
The Strategy pattern defines a family of algorithms, encapsulates each of them and make them interchangeables. Strategy allows the algorithm to change regardless of the clients that use it.