title | date | lastmod |
---|---|---|
Strategy Pattern |
2022-11-08 |
2023-02-12 |
- 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.
- Encapsulation
- Hides implementation
- Allows behaviour change at runtime
- Complexity if overused