Strategy வடிவமைப்பு ஒரு குடும்பத்தின் பரிமாற்றக்கூடிய வழிமுறைகள்/நடத்தைகளை வரையறுக்கிறது, ஒவ்வொன்றையும் பொதிந்து, மற்றும் ஏforeach்குமுறையில் அவற்றை மாற்றத்தக்கவை செய்கிறது. இது ஒரு வழிமுறையை மாறுபட்ட முறையில் தேர்ந்தெடுக்க உங்களை அனுமதிக்கிறது மற்றும் சிக்கலான நிபந்தனைகளைத் தவிர்க்கிறது, நমনীய, விரிவடையக்கூடிய குறியீட்டை பிரচாரிக்கிறது.
Strategy வடிவமைப்பு என்ன செய்கிறது
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)
