Avoiding Conditional Logic:?
- Without the strategy pattern, you might need to use complex conditionals (like
if-else or switch) to determine which algorithm to use. The strategy
pattern eliminates this by encapsulating the algorithm in separate classes.