Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Command pattern
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Structure == === UML class and sequence diagram === [[File:w3sDesign Command Design Pattern UML.jpg|frame|none|A sample UML class and sequence diagram for the Command design pattern. <ref>{{cite web |title=The Command design pattern - Structure and Collaboration |url=http://w3sdesign.com/?gr=b02&ugr=struct |archive-url=https://web.archive.org/web/20200923120537/http://w3sdesign.com/?gr=b02&ugr=struct |url-status=dead |archive-date=September 23, 2020 |access-date=2017-08-12 |website=w3sDesign.com}}</ref>]] In the above [[Unified Modeling Language|UML]] [[class diagram]], the <code>Invoker</code> class doesn't implement a request directly. Instead, <code>Invoker</code> refers to the <code>Command</code> interface to perform a request (<code>command.execute()</code>), which makes the <code>Invoker</code> independent of how the request is performed. The <code>Command1</code> class implements the <code>Command</code> interface by performing an action on a receiver (<code>receiver1.action1()</code>). The [[Unified Modeling Language|UML]] [[sequence diagram]] shows the run-time interactions: The <code>Invoker</code> object calls <code>execute()</code> on a <code>Command1</code> object. <code>Command1</code> calls <code>action1()</code> on a <code>Receiver1</code> object, which performs the request. === UML class diagram === [[File:Command pattern.svg|thumb|700px|center|UML diagram of the command pattern]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)