The following lists the benefits of using the Strategy pattern:
- An alternative to subclassing
- Defines each behavior in its own class, which eliminates conditional statements
- Easier to extend a model to incorporate new behaviors without recoding the application
You should use the Strategy pattern when:
- Many related classes differ only in their behavior.
- You need different variants of an algorithm.
- An algorithm uses data unknown to clients.