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
