Strategy pattern ngrancang sawijining kulawarga saka algoritma/perilaku sing bisa ditukar-tukar, ngaenkapsulasi saben-bene, lan nggawe bisa ditukar-tukar ing waktu runtime. Iki ngidini sampeyan milih algoritma kanthi dinamis lan nglindhari kondisional kompleks, ngendel kode sing fleksibel lan extensible.
Sing didol dening 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)
