Command Pattern.

Slides:



Advertisements
Similar presentations
Command Explained. Intent Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests,
Advertisements

GoF Sections 2.7 – 2.9 More Fun with Lexi. Lexi Document Editor Lexi tasks discussed:  Document structure  Formatting  Embellishing the user interface.
Design patterns Glenn D. Blank. Definitions A pattern is a recurring solution to a standard problem, in a context. Christopher Alexander, a professor.
Computer Science 313 – Advanced Programming Topics.
Command Pattern 1. Intent Encapsulates a request as an object, thereby letting you parameterize other objects with different requests, queue or log request,
March Ron McFadyen1 Command The command pattern encapsulates a request or unit of work into an object. An invoker will ask a concrete command.
Design Patterns In OPM Presented by: Galia Shlezinger Instructors: Prop. Dov Dori, Dr. Iris Berger.
Software Design & Documentation – Design Pattern: Command Design Pattern: Command Christopher Lacey September 15, 2003.
Copyright © 1995 –2004 Active Frameworks Inc. - All Rights Reserved - V2.0Behavioral Patterns - Page L8-1 PS95&96-MEF-L15-1 Dr. M.E. Fayad Creationa l.
Spring 2010ACS-3913 Ron McFadyen1 Command The complex remote control (many pairs of buttons; null command) Undo … pages 216+ Macro … pages 224+
Feb Ron McFadyen1 Adapter An adapter converts the interface of a class into another interface the client expects. An adapter lets classes work.
Command Pattern Chihung Liao Cynthia Jiang. Waiter Order Execute() Hamburger Execute() Hot Dogs Execute() Fries Execute() Cook Make Food()
Spring 2010ACS-3913 Ron McFadyen1 Command The command pattern encapsulates a request or unit of work into an object. An invoker will ask a concrete command.
Improving UML Class Diagrams using Design Patterns Semantics Shahar Maoz Work in Progress.
GoF Sections 2.7 – 2.9 More Fun with Lexi. Lexi Document Editor Lexi tasks discussed:  Document structure  Formatting  Embellishing the user interface.
Command Pattern When Actions Speak Louder Than Words.
The Design of JUnit Yonglei Tao. Test-First Development  An essential element in eXtreme Programming (XP)  Test is written before the code  As an executable.
Behavioral Patterns  Behavioral patterns are patterns whose purpose is to facilitate the work of algorithmic calculations and communication between classes.
CS 210 Introduction to Design Patterns September 28 th, 2006.
CD Database Server (CDDB) Zachary Carter Alan Savage Diana Abbas Kyle Dorman.
Design Patterns Part two. Structural Patterns Concerned with how classes and objects are composed to form larger structures Concerned with how classes.
Design Pattern. The Observer Pattern The Observer Pattern defines a one-to-many dependency between objects so that when one object changes state, all.
Behavioral Pattern: Command C h a p t e r 5 – P a g e 139 There are times when the need arises to issue a request to an object without knowing anything.
Command. RHS – SOC 2 Executing a command Executing a command appears simple at first, but many details to consider: –Who creates a command? –Who invokes.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns VII Observer, Command, and Memento.
1 Command Design Pattern Rick Mercer and Rice University.
Good IOS MDM (continue) – Testing and Troubleshooting Presented by: Jerry Wen 03/14/2012.
Lexi case study (Part 2) Presentation by Matt Deckard.
CS 210 Introduction to Design Patterns September 26 th, 2006.
CS 210 Adapter Pattern October 19 th, Adapters in real life Page 236 – Head First Design Patterns.
1 Command Design Pattern Rick Mercer. Command Design Pattern The Command Pattern encapsulates a request as an object, thereby letting you queue commands,
Linzhang Wang Dept. of Computer Sci&Tech, Nanjing University The Command Pattern.
Computer Science 313 – Advanced Programming Topics.
CS 210 Review Session October 5 th, Head First Design Patterns Chapter 4 Factory Pattern.
Title Carolina First Steering Committee October 9, 2010 Online Voting System Design Yinpeng Li and Tian Cao May 3, 2011.
Dev 328.NET & J2EE Strategies for Interoperability David Aiken Lead Enterprise Architect.
CS 210 Final Review November 28, CS 210 Adapter Pattern.
BEHAVIORAL PATTERNS 13-Sep-2012 Presenters Sanjeeb Kumar Nanda & Shankar Gogada.
Interface Patterns. Adapter Provides the interface a client expects, using the services of a class with a different interface Note Avoid using object.
Elaboration Iteration 3 – Part 3 - Persistence Framework -
Example to motivate discussion We have two lists (of menu items) one implemented using ArrayList and another using Arrays. How does one work with these.
CS 210 Proxy Pattern Nov 16 th, RMI – A quick review A simple, easy to understand tutorial is located here:
Chapter 8 Object Design Reuse and Patterns. More Patterns Abstract Factory: Provide manufacturer independence Builder: Hide a complex creation process.
Reference – Object Oriented Software Development Using Java - Jia COP 3331 Object Oriented Analysis and Design Chapter 10 – Patterns Jean Muhammad.
I Like Ike I have always found that plans are useless, but planning is indispensable.
Five Minute Design Patterns Doug Marttila Forest and the Trees May 30, 2009 Template Factory Singleton Iterator Adapter Façade Observer Command Strategy.
Design Patterns. Outline Purpose Purpose Useful Definitions Useful Definitions Pattern Overview Pattern Overview.
The Command Pattern SE-2811 Dr. Mark L. Hornick 1.
Command. RHS – SWC 2 Executing a command Executing a command appears simple at first, but many details to consider: –Who creates a command? –Who invokes.
STRATEGY PATTERN By Michelle Johnson. BACKGROUND Behavioral Pattern Allow you to define a family of algorithms, encapsulate each one, and make them interchangeable.
Command Pattern Encapsulation Invocation. One size fits all.
Overview of Behavioral Patterns ©SoftMoore ConsultingSlide 1.
Review of last class. Design patterns CreationalStructuralBehavioral Abstract Factory Builder Factory Singleton etc. Adapter Bridge Composite Decorator.
Command Pattern. Intent encapsulate a request as an object  can parameterize clients with different requests, queue or log requests, support undoable.
Programming with Patterns Jeremy Cronan Alliance Safety Council
Strategy Pattern.
Façade Pattern:.
Software Design Patterns
Behavioral Design Patterns
Singleton Pattern Command Pattern
Programming Design Patterns
Doug Jeffries CS490 Design Patterns May 1, 2003
Command Pattern 1.
Command Design Pattern
Design Patterns Satya Puvvada Satya Puvvada.
State Design Pattern 1.
PH Chapter 3 Thanks for the Memory Leaks Pushme-Pullyu (pp
ECARS - INCOMPLETE SERVICE REQUESTS.
Click Summary Value Button to Show Source of Integral or Time
The Command Design Pattern
Presentation transcript:

Command Pattern

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)

(Imperfect) Diner Analogy Customer (client); Order (command); Waitress (invoker); Cook (receiver);

Home Automation Remote Example

Ventor Supplied Classes

Command Object

Command Pattern Defined

Command Pattern Class Diagram

Implement Remote Control

Support Undo

Undo with State

MacroCommand

Use Case: Queuing Requests

Use Case: Logging Requests