A Strategy minta meghatároz egy csere-algoritmust/viselkedést, mindegyiket beágyazza, és futásidőben cserélhetővé teszi. Lehetővé teszi, hogy dinamikusan válassz algoritmust és elkerüld az összetett feltételeket, ezzel rugalmas, kiterjeszthető kódot biztosít.
Mit tesz a Strategy minta
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)
