Strategy pattern กำหนดกลุ่มของอัลกอริทึม/พฤติกรรมที่สลับกันได้ ห่อหุ้มแต่ละตัว และทำให้สลับกันได้ขณะ runtime มันช่วยให้คุณเลือกอัลกอริทึมแบบไดนามิกและหลีกเลี่ยงเงื่อนไขที่ซับซ้อน ส่งเสริมโค้ดที่ยืดหยุ่นและขยายได้
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)
