Το Strategy pattern ορίζει μια οικογένεια ανταλλάξιμων αλγορίθμων/συμπεριφορών, τα ενθυλακώνει και τα κάνει αντικαταστάσιμα κατά την εκτέλεση. Σας επιτρέπει να επιλέξετε έναν αλγόριθμο δυναμικά και να αποφύγετε πολύπλοκα condition statements, προωθώντας ευέλικτο και επεκτάσιμο κώδικα.
Τι κάνει το Strategy pattern
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)
