Command pattern ले एक अनुरोधलाई एक वस्तुको रूपमा समावेश गर्छ — एक कार्यलाई यसको सबै जानकारी सहित एक स्वतन्त्र वस्तुमा परिणत गर्छ। यसले queuing, logging, undo/redo, र अनुरोधकर्ताको अनुरोधकारीबाट अलग गर्न सक्षम बनाउँछ।
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
