The Strategy pattern defines a family of interchangeable algorithms/behaviors, encapsulates each, and makes them swappable at runtime. It lets you select an algorithm dynamically and avoid complex conditionals, promoting flexible, extensible code.
What the Strategy pattern does
STRATEGY → encapsulate INTERCHANGEABLE algorithms/behaviors behind a common interface:
→ define a family of strategies (each implements the same interface)
→ the context uses a strategy via the interface → can SWAP strategies at runtime
→ choose the behavior dynamically without changing the context
→ "compose" behavior instead of hardcoding it (favor composition over conditionals)
