Defines a family of algorithms, encapsulates each one and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
- Encapsulate what varies
- Favor composition over Inheritance
- Program to interfaces, not implementations
For setting Behavior dynamically we can use setter method for that Behavior
All factory Patterns encapsulate object creation. The Factory Method Pattern encapsulates object creation by letting subclasses decide what object to create.
The Command Pattern encapsulates a request as an object, therefore letting you parameterize other objects with different requests, queue or log requests, and support undoable operations.