Download presentation
Presentation is loading. Please wait.
1
Command Pattern
2
Command Pattern Intent Also known as “Action” or “Transaction”
Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests,and support undoable operations. Also known as “Action” or “Transaction” Motivating example GUI button or menuitem, when clicked, do some action. The button or menuitem (the invoker) do not have to know what actions are being carried out and by whom (the receiver)
3
(Imperfect) Diner Analogy
Customer (client); Order (command); Waitress (invoker); Cook (receiver);
4
Home Automation Remote Example
5
Ventor Supplied Classes
6
Command Object
7
Command Pattern Defined
8
Command Pattern Class Diagram
9
Implement Remote Control
10
Support Undo
11
Undo with State
12
MacroCommand
13
Use Case: Queuing Requests
14
Use Case: Logging Requests
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.