A Command pattern egy kérést objektumként ágyaz be — egy műveletet egy önálló objektummá alakít, amely tartalmazza az összes szükséges információt. Ez lehetővé teszi a sorbaállítást, naplózást, visszavonást/ismétlést, valamint a kérelmező és a végrehajtó közötti decoupling-ot.
Mit csinál a 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
