Command Pattern

963 views

Published on

Command Patter, Stewart Gleadow, February 3rd 2010

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
963
On SlideShare
0
From Embeds
0
Number of Embeds
36
Actions
Shares
0
Downloads
15
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Command Pattern

  1. 1. Command Design Pattern<br />(Action, Transaction)<br />
  2. 2. Outline<br />Intent & Motivation<br />Structure<br />Applicability & Implementation<br />Examples<br />
  3. 3. Intent & Motivation<br />Encapsulate a request as an object<br />Issue requests without knowing operation<br />eg. Button & MenuItem in a toolkit<br />
  4. 4. Basic Structure<br />abstract Command class to define interface<br />Concrete implementation links command to receiver<br />
  5. 5. Structure<br />
  6. 6. Applicability & Consequences<br />Decouple invoker and receiver<br />Link same command to multiple invokers<br />MacroCommand: chain commands together<br />Undo/Redo: store state and reversal<br />
  7. 7. Implementation<br />Command intelligence<br />State Information<br />Receiver, Arguments, Original Values, Copy Command<br />Binding Only<br />No Separate Receiver<br />
  8. 8. Example…<br />

×