Das Strategy-Pattern definiert eine Familie von auswechselbaren Algorithmen/Verhaltensweisen, kapselt jede ein und macht sie zur Laufzeit austauschbar. Es ermöglicht die dynamische Auswahl eines Algorithmus und vermeidet komplexe Bedingungen, was flexiblen, erweiterbaren Code fördert.
Was das Strategy-Pattern tut
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)
