Command pattern

Command pattern

In object-oriented programming, the command pattern is a behavioral design pattern in which an object is used to encapsulate all information needed to perform an action or trigger an event at a later time. This information includes the method name, the object that owns the method and values for the method parameters. The central ideas of this design pattern closely mirror the semantics of first-class functions and higher-order functions in functional programming languages. Specifically, the invoker object is a higher-order function of which the command object is a first-class argument.

Comment
enIn object-oriented programming, the command pattern is a behavioral design pattern in which an object is used to encapsulate all information needed to perform an action or trigger an event at a later time. This information includes the method name, the object that owns the method and values for the method parameters. The central ideas of this design pattern closely mirror the semantics of first-class functions and higher-order functions in functional programming languages. Specifically, the invoker object is a higher-order function of which the command object is a first-class argument.
Depiction
Command pattern.svg
W3sDesign Command Design Pattern UML.jpg
Has abstract
enIn object-oriented programming, the command pattern is a behavioral design pattern in which an object is used to encapsulate all information needed to perform an action or trigger an event at a later time. This information includes the method name, the object that owns the method and values for the method parameters. Four terms always associated with the command pattern are command, receiver, invoker and client. A command object knows about receiver and invokes a method of the receiver. Values for parameters of the receiver method are stored in the command. The receiver object to execute these methods is also stored in the command object by aggregation. The receiver then does the work when the execute method in command is called. An invoker object knows how to execute a command, and optionally does bookkeeping about the command execution. The invoker does not know anything about a concrete command, it knows only about the command interface. Invoker object(s), command objects and receiver objects are held by a client object, the client decides which receiver objects it assigns to the command objects, and which commands it assigns to the invoker. The client decides which commands to execute at which points. To execute a command, it passes the command object to the invoker object. Using command objects makes it easier to construct general components that need to delegate, sequence or execute method calls at a time of their choosing without the need to know the class of the method or the method parameters. Using an invoker object allows bookkeeping about command executions to be conveniently performed, as well as implementing different modes for commands, which are managed by the invoker object, without the need for the client to be aware of the existence of bookkeeping or modes. The central ideas of this design pattern closely mirror the semantics of first-class functions and higher-order functions in functional programming languages. Specifically, the invoker object is a higher-order function of which the command object is a first-class argument.
Hypernym
Pattern
Is primary topic of
Command pattern
Label
enCommand pattern
Link from a Wikipage to an external page
wiki.c2.com/%3FCommandPattern
www.infoworld.com/article/2077569/java-tip-68--learn-how-to-implement-the-command-pattern-in-java.html
msdn.microsoft.com/en-us/library/ms752308.aspx
Link from a Wikipage to another Wikipage
Ambiguity
Batch queue
Behavioral pattern
Bertrand Meyer
Borland Delphi
Category:Articles with example C Sharp code
Category:Articles with example Java code
Category:Articles with example JavaScript code
Category:Articles with example Python (programming language) code
Category:Articles with example Ruby code
Category:Articles with example Scala code
Category:Software design patterns
Chain of responsibility pattern
Class diagram
Closure (computer science)
Code mobility
Command queue
Database transaction
Design pattern (computer science)
Design Patterns
File:Command pattern.svg
File:W3sDesign Command Design Pattern UML.jpg
First-class function
Functional programming language
Function object
Gang of Four (software)
Higher-order function
Homonyms
Information hiding
Job scheduler
Macro (computer science)
Model–view–controller
Object composition
Object-oriented programming
Object-oriented Software Construction
Priority queue
Progress bar
Sequence diagram
Software design pattern
Swing (Java)
Synonyms
Thread pool
Undo
Unified Modeling Language
Windows Presentation Foundation
Wizard (software)
SameAs
3ZtuC
Comando (padrón de deseño)
Command
Command
Command (patrón de diseño)
Commande (patron de conception)
Commandopatroon
Command pattern
Command pattern
Command パターン
Kommando (designmönster)
Kommando (Entwurfsmuster)
m.015ysk
Parancs programtervezési minta
Polecenie (wzorzec projektowy)
Q386776
Команда (шаблон)
Команда (шаблон проектирования)
Команда (шаблон проєктування)
Հրաման (նախագծման ձևանմուշ)
תבנית Command
الگوی فرمان
命令模式
커맨드 패턴
Subject
Category:Articles with example C Sharp code
Category:Articles with example Java code
Category:Articles with example JavaScript code
Category:Articles with example Python (programming language) code
Category:Articles with example Ruby code
Category:Articles with example Scala code
Category:Software design patterns
Thumbnail
W3sDesign Command Design Pattern UML.jpg?width=300
WasDerivedFrom
Command pattern?oldid=1121584752&ns=0
WikiPageLength
20078
Wikipage page ID
164858
Wikipage revision ID
1121584752
WikiPageUsesTemplate
Template:Commons category
Template:Design Patterns Patterns
Template:Mono
Template:No footnotes
Template:Reflist
Template:Wikibooks