Strategy Pattern
# Strategy Pattern
# Problems we want to solve
- A set of interchangeable algorithms or objects that can be decided at run-time
- Extensible set of strategies: Open-Closed Principle
Context refers or uses the Strategy interface for performing the algorithm. A and B classes implement the Strategy interface which gives the concrete algorithms.
# Pros
- Encapsulation
- Hides implementation
- Allows behaviour change at runtime
# Cons
- Complexity if overused