Het Strategy-patroon definieert een familie van uitwisselbare algoritmes/gedragingen, encapsuleert elk daarvan, en maakt ze verwisselbaar tijdens runtime. Het laat je dynamisch een algoritme selecteren en complexe voorwaardelijke statements vermijden, wat flexibele en uitbreidbare code bevordert.
Wat het Strategy-patroon doet
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)
