Command pattern ஒரு request ஐ object ஆக encapsulate செய்கிறது — ஒரு action ஐ அதன் அனைத்து தகவல்கள் உடன் standalone object ஆக மாற்றுகிறது. இது queuing, logging, undo/redo, மற்றும் requester ஐ executor இலிருந்து decoupling செய்ய உதவுகிறது.
Command pattern என்ன செய்கிறது
COMMAND → encapsulate an action/request as an OBJECT (with its data and an execute method):
→ a command object knows WHAT to do and has the info to do it
→ the invoker triggers commands without knowing their details
→ decouples the object that INVOKES from the object that PERFORMS the action
→ "turn an action into an object" → store, pass, queue, log, undo it
