SlideShare ist ein Scribd-Unternehmen logo
1 von 74
Downloaden Sie, um offline zu lesen
Design Patterns 05/28/10 Week 4: Command and Adapter Jonathan Simon [email_address]
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Remote Control ,[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
First Thoughts ,[object Object],[object Object],[object Object],05/28/10
What Varies?  What stays the same? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
The Vendor Classes (pg 194) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
One possible solution… ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10 Problems: The Remote needs to be aware of all the details about turning a device on (or off). If device On/Off mechanism changes, the Remote code will need to be changed. If a new device is added, this code would need to be changed. Is this Open for Extension?? Also…what about undo????
Separation of Concerns ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
The Command Pattern ,[object Object],[object Object],[object Object],05/28/10
Command Interface (pg203) ,[object Object],[object Object],[object Object],[object Object],05/28/10
LightOnCommand (pg203) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10 The command is composed of a vendor class. Constructor  takes the vendor class as parameter. Here the command  delegates execution to the vendor class.  Note : This is a simple example..there could be more steps.
SimpleRemoteControl (pg204) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10 This version of the remote just has one slot. setCommand assigns a Command to a slot. Tells the command to execute. Note that any command would work here.  The remote doesn’t know anything about the specific vendor class.
RemoteControlTest (pg204) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10 Create two vendor classes. Create two commands based on these vendor classes. Set the command and press button
The Command Pattern ,[object Object],[object Object],[object Object],[object Object],05/28/10
Definitions (see Diagram on pg 207) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Lab Part I ,[object Object],[object Object],05/28/10
Lab Part II ,[object Object],[object Object],05/28/10
Lab Part III (Design Challenge!) ,[object Object],[object Object],[object Object],05/28/10
Lab Part I Answer ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Lab Part I Answer (cont) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Lab Part II  Answer ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Lab Part III (Answer) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Lab Part III (Answer) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],We don’t want on(), off(), and undo() to be overridden.
Lab Part III ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Lab Part III ,[object Object],[object Object],[object Object],[object Object],05/28/10
History of Undo Operations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
History of Undo Operations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Simple Logging ,[object Object],[object Object],05/28/10
Simple Logging ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10 Advantage: We can add logging in the Invoker. No change is needed in any of the Command or Receiver objects!
Complex Logging ,[object Object],[object Object],[object Object],05/28/10
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Complex Logging  05/28/10 Once again, we can make these changes in one place (the Invoker)
Case Study: Command Management 05/28/10 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Question ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Possible Solutions ,[object Object],[object Object],[object Object],05/28/10
Disadvantages ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Command Management Framework ,[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Example ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Command Manager 05/28/10 The Commands property contains a list of all possible Commands. CommandsList contains a List object internally for storing each possible Command.  It also has a reference to CommandManager.
Command Object ExecuteHandler = delegate that represents the logic for executing the actual Command logic.  Triggered when the command is executed. Gets associated with OnExecute event. UpdateHandler = delegate that represents the logic for executing the logic to update the state of a command. (For example, Edit    Copy should be enabled if text has been selected).  Associated with OnUpdate event.
Command Constructor ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10 Associates events to delegates
Command: Execute() and ProcessUpdates() ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Will call the function passed in as ExecuteHandler Will call the function passed in as UpdateHandler How is this Command.Execute() different than the RemoteControl example??
Re-look at EditCopy ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10 Will discuss later
So far.. 05/28/10 Command #1 Tag = “Edit Copy” OnExecute = OnCopy OnUpdate =  UpdateCopyCommand Command #2 Tag = “File Open” OnExecute = OnFileOpen OnUpdate =  null
Associating UI Elements to a Command ,[object Object],[object Object],[object Object],[object Object],05/28/10 What object contains the CommandInstances property??
CommandInstances 05/28/10 Contain a list of all UI Elements associated with a Command
So far.. 05/28/10 Command #1 Tag = “Edit Copy” OnExecute = OnCopy OnUpdate =  UpdateCopyCommand Two items: mnuEditCopy tlbMain.Buttons[4] All we have done so far is store information…
How do we enable a Command??? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Are you enabled???
Command.ProcessUpdates() ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10 If we do need to enable (or disable) the Command, who do we need to tell to “go enable/disable yourself?”
Command.Enabled Property ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Command.Enabled (Psuedo-Code) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10 Question:  Any problems with this code???
Command.Enabled (Psuedo-Code) ,[object Object],[object Object],[object Object],[object Object],05/28/10
CommandExecutor 05/28/10 Enable() is abstract.  Toolbar and Menu subclasses must define how Enable needs to work.
CommandExecutor ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Command.Enabled (Real Code) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],CommandManager actually contains all possible CommandExecutors. These are registered during start-up for each possible type of UI element. (CommandManager constructor)
CommandExecutor - Execution ,[object Object],[object Object],05/28/10
MenuCommandExecutor ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10 Called when we added UI element to Command
Example (Again) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Confused? ,[object Object],[object Object],05/28/10
Distributed Command Pattern ,[object Object],[object Object],05/28/10
Adapter Pattern ,[object Object],[object Object],05/28/10
Real Life Examples ,[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Drawback ,[object Object],[object Object],05/28/10
Example 1 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10 Generated Code!!!
Example 1 ,[object Object],[object Object],[object Object],[object Object],05/28/10 Imagine these lines of code were in different parts of the system. What happens when SaveCustomer gets re-generated?
Example 1 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Lab ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Lab ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Lab ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Lab ,[object Object],[object Object],05/28/10
Answer: Two Way Adapter ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Answer ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Answer ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10
Answer: Reworked Code ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],05/28/10

Weitere ähnliche Inhalte

Was ist angesagt? (20)

Template pattern
Template patternTemplate pattern
Template pattern
 
EJB .
EJB .EJB .
EJB .
 
The State Design Pattern
The State Design PatternThe State Design Pattern
The State Design Pattern
 
Chain of responsibility
Chain of responsibilityChain of responsibility
Chain of responsibility
 
Visitor Pattern
Visitor PatternVisitor Pattern
Visitor Pattern
 
Visitor pattern
Visitor patternVisitor pattern
Visitor pattern
 
[26]자동화, 계륵에 살 붙이기 : Evolution of Android Automation Test
[26]자동화, 계륵에 살 붙이기 : Evolution of Android Automation Test[26]자동화, 계륵에 살 붙이기 : Evolution of Android Automation Test
[26]자동화, 계륵에 살 붙이기 : Evolution of Android Automation Test
 
DESIGN PATTERNS: Strategy Patterns
DESIGN PATTERNS: Strategy PatternsDESIGN PATTERNS: Strategy Patterns
DESIGN PATTERNS: Strategy Patterns
 
Singleton design pattern
Singleton design patternSingleton design pattern
Singleton design pattern
 
Command pattern
Command patternCommand pattern
Command pattern
 
State
StateState
State
 
2 use case narratives
2 use case narratives2 use case narratives
2 use case narratives
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Android Lesson 3 - Intent
Android Lesson 3 - IntentAndroid Lesson 3 - Intent
Android Lesson 3 - Intent
 
Notification android
Notification androidNotification android
Notification android
 
Servlets
ServletsServlets
Servlets
 
ClearCase Basics
ClearCase BasicsClearCase Basics
ClearCase Basics
 
Observer Software Design Pattern
Observer Software Design Pattern Observer Software Design Pattern
Observer Software Design Pattern
 
Chain of Responsibility Pattern
Chain of Responsibility PatternChain of Responsibility Pattern
Chain of Responsibility Pattern
 
enterprise java bean
enterprise java beanenterprise java bean
enterprise java bean
 

Andere mochten auch

Strategy and Template Pattern
Strategy and Template PatternStrategy and Template Pattern
Strategy and Template PatternJonathan Simon
 
MVC and Other Design Patterns
MVC and Other Design PatternsMVC and Other Design Patterns
MVC and Other Design PatternsJonathan Simon
 
Command Design Pattern
Command Design PatternCommand Design Pattern
Command Design PatternRothana Choun
 
Design patterns - Singleton&Command
Design patterns - Singleton&CommandDesign patterns - Singleton&Command
Design patterns - Singleton&CommandKai Aras
 
Introduction to Design Patterns and Singleton
Introduction to Design Patterns and SingletonIntroduction to Design Patterns and Singleton
Introduction to Design Patterns and SingletonJonathan Simon
 
Factory and Abstract Factory
Factory and Abstract FactoryFactory and Abstract Factory
Factory and Abstract FactoryJonathan Simon
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Patternguy_davis
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design PatternAdeel Riaz
 
"Pushing the boundaries" por @danielguillan
"Pushing the boundaries" por @danielguillan"Pushing the boundaries" por @danielguillan
"Pushing the boundaries" por @danielguillanwebcat
 
Model View Command Pattern
Model View Command PatternModel View Command Pattern
Model View Command PatternAkash Kava
 
Design Patterns
Design PatternsDesign Patterns
Design Patternsppd1961
 
Android ui adapter
Android ui adapterAndroid ui adapter
Android ui adapterKrazy Koder
 
Android sync adapter
Android sync adapterAndroid sync adapter
Android sync adapterAlex Tumanoff
 
Client-Server-Kommunikation mit dem Command Pattern
Client-Server-Kommunikation mit dem Command PatternClient-Server-Kommunikation mit dem Command Pattern
Client-Server-Kommunikation mit dem Command Patternpgt technology scouting GmbH
 
Retail Institution Report
Retail Institution ReportRetail Institution Report
Retail Institution ReportFridz Felisco
 
Design Patterns - 03 Composite and Flyweight Pattern
Design Patterns - 03 Composite and Flyweight PatternDesign Patterns - 03 Composite and Flyweight Pattern
Design Patterns - 03 Composite and Flyweight Patterneprafulla
 
Javascript Common Design Patterns
Javascript Common Design PatternsJavascript Common Design Patterns
Javascript Common Design PatternsPham Huy Tung
 

Andere mochten auch (20)

Strategy and Template Pattern
Strategy and Template PatternStrategy and Template Pattern
Strategy and Template Pattern
 
MVC and Other Design Patterns
MVC and Other Design PatternsMVC and Other Design Patterns
MVC and Other Design Patterns
 
Command Design Pattern
Command Design PatternCommand Design Pattern
Command Design Pattern
 
Design patterns - Singleton&Command
Design patterns - Singleton&CommandDesign patterns - Singleton&Command
Design patterns - Singleton&Command
 
Introduction to Design Patterns and Singleton
Introduction to Design Patterns and SingletonIntroduction to Design Patterns and Singleton
Introduction to Design Patterns and Singleton
 
Factory and Abstract Factory
Factory and Abstract FactoryFactory and Abstract Factory
Factory and Abstract Factory
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
 
"Pushing the boundaries" por @danielguillan
"Pushing the boundaries" por @danielguillan"Pushing the boundaries" por @danielguillan
"Pushing the boundaries" por @danielguillan
 
Command Pattern
Command PatternCommand Pattern
Command Pattern
 
Model View Command Pattern
Model View Command PatternModel View Command Pattern
Model View Command Pattern
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Android ui adapter
Android ui adapterAndroid ui adapter
Android ui adapter
 
Android sync adapter
Android sync adapterAndroid sync adapter
Android sync adapter
 
Decorator design pattern
Decorator design patternDecorator design pattern
Decorator design pattern
 
Client-Server-Kommunikation mit dem Command Pattern
Client-Server-Kommunikation mit dem Command PatternClient-Server-Kommunikation mit dem Command Pattern
Client-Server-Kommunikation mit dem Command Pattern
 
Retail Institution Report
Retail Institution ReportRetail Institution Report
Retail Institution Report
 
Design Patterns - 03 Composite and Flyweight Pattern
Design Patterns - 03 Composite and Flyweight PatternDesign Patterns - 03 Composite and Flyweight Pattern
Design Patterns - 03 Composite and Flyweight Pattern
 
Iterator Pattern
Iterator PatternIterator Pattern
Iterator Pattern
 
Javascript Common Design Patterns
Javascript Common Design PatternsJavascript Common Design Patterns
Javascript Common Design Patterns
 

Ähnlich wie Command and Adapter Pattern

Session2-J2ME development-environment
Session2-J2ME development-environmentSession2-J2ME development-environment
Session2-J2ME development-environmentmuthusvm
 
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-insEclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-insTonny Madsen
 
Contiki Operating system tutorial
Contiki Operating system tutorialContiki Operating system tutorial
Contiki Operating system tutorialSalah Amean
 
Convergence
ConvergenceConvergence
Convergencedonwelch
 
Print Testing
Print TestingPrint Testing
Print Testingdonwelch
 
Implementing of classical synchronization problem by using semaphores
Implementing of classical synchronization problem by using semaphoresImplementing of classical synchronization problem by using semaphores
Implementing of classical synchronization problem by using semaphoresGowtham Reddy
 
MicroPython for LEGO Spike - introduction
MicroPython for LEGO Spike - introductionMicroPython for LEGO Spike - introduction
MicroPython for LEGO Spike - introductionsdoro58
 
Composing an App with Free Monads (using Cats)
Composing an App with Free Monads (using Cats)Composing an App with Free Monads (using Cats)
Composing an App with Free Monads (using Cats)Hermann Hueck
 
Taming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
Taming startup dynamics - Magnus Jungsbluth & Domagoj CosicTaming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
Taming startup dynamics - Magnus Jungsbluth & Domagoj Cosicmfrancis
 
PART-2 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
PART-2 : Mastering RTOS FreeRTOS and STM32Fx with DebuggingPART-2 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
PART-2 : Mastering RTOS FreeRTOS and STM32Fx with DebuggingFastBit Embedded Brain Academy
 
Refactoring Simple Example
Refactoring Simple ExampleRefactoring Simple Example
Refactoring Simple Exampleliufabin 66688
 
WHQL USB DTM Quick Start How-to
WHQL USB DTM Quick Start How-toWHQL USB DTM Quick Start How-to
WHQL USB DTM Quick Start How-tocamhirundo
 
QEMU - Binary Translation
QEMU - Binary Translation QEMU - Binary Translation
QEMU - Binary Translation Jiann-Fuh Liaw
 
Loops_and_FunctionsWeek4_0.ppt
Loops_and_FunctionsWeek4_0.pptLoops_and_FunctionsWeek4_0.ppt
Loops_and_FunctionsWeek4_0.pptKamranAli649587
 

Ähnlich wie Command and Adapter Pattern (20)

Session2-J2ME development-environment
Session2-J2ME development-environmentSession2-J2ME development-environment
Session2-J2ME development-environment
 
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-insEclipse Summit Europe '10 - Test UI Aspects of Plug-ins
Eclipse Summit Europe '10 - Test UI Aspects of Plug-ins
 
Contiki Operating system tutorial
Contiki Operating system tutorialContiki Operating system tutorial
Contiki Operating system tutorial
 
Convergence
ConvergenceConvergence
Convergence
 
Print Testing
Print TestingPrint Testing
Print Testing
 
Implementing of classical synchronization problem by using semaphores
Implementing of classical synchronization problem by using semaphoresImplementing of classical synchronization problem by using semaphores
Implementing of classical synchronization problem by using semaphores
 
MicroPython for LEGO Spike - introduction
MicroPython for LEGO Spike - introductionMicroPython for LEGO Spike - introduction
MicroPython for LEGO Spike - introduction
 
Composing an App with Free Monads (using Cats)
Composing an App with Free Monads (using Cats)Composing an App with Free Monads (using Cats)
Composing an App with Free Monads (using Cats)
 
Taming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
Taming startup dynamics - Magnus Jungsbluth & Domagoj CosicTaming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
Taming startup dynamics - Magnus Jungsbluth & Domagoj Cosic
 
PART-2 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
PART-2 : Mastering RTOS FreeRTOS and STM32Fx with DebuggingPART-2 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
PART-2 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
 
Refactoring Simple Example
Refactoring Simple ExampleRefactoring Simple Example
Refactoring Simple Example
 
CH05.pdf
CH05.pdfCH05.pdf
CH05.pdf
 
WHQL USB DTM Quick Start How-to
WHQL USB DTM Quick Start How-toWHQL USB DTM Quick Start How-to
WHQL USB DTM Quick Start How-to
 
QEMU - Binary Translation
QEMU - Binary Translation QEMU - Binary Translation
QEMU - Binary Translation
 
Loops_and_FunctionsWeek4_0.ppt
Loops_and_FunctionsWeek4_0.pptLoops_and_FunctionsWeek4_0.ppt
Loops_and_FunctionsWeek4_0.ppt
 
myslide1
myslide1myslide1
myslide1
 
NewSeriesSlideShare
NewSeriesSlideShareNewSeriesSlideShare
NewSeriesSlideShare
 
myslide6
myslide6myslide6
myslide6
 
Microkernel Development
Microkernel DevelopmentMicrokernel Development
Microkernel Development
 
JUNit Presentation
JUNit PresentationJUNit Presentation
JUNit Presentation
 

Kürzlich hochgeladen

Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 

Kürzlich hochgeladen (20)

20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 

Command and Adapter Pattern

  • 1. Design Patterns 05/28/10 Week 4: Command and Adapter Jonathan Simon [email_address]
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39. Command Manager 05/28/10 The Commands property contains a list of all possible Commands. CommandsList contains a List object internally for storing each possible Command. It also has a reference to CommandManager.
  • 40. Command Object ExecuteHandler = delegate that represents the logic for executing the actual Command logic. Triggered when the command is executed. Gets associated with OnExecute event. UpdateHandler = delegate that represents the logic for executing the logic to update the state of a command. (For example, Edit  Copy should be enabled if text has been selected). Associated with OnUpdate event.
  • 41.
  • 42.
  • 43.
  • 44. So far.. 05/28/10 Command #1 Tag = “Edit Copy” OnExecute = OnCopy OnUpdate = UpdateCopyCommand Command #2 Tag = “File Open” OnExecute = OnFileOpen OnUpdate = null
  • 45.
  • 46. CommandInstances 05/28/10 Contain a list of all UI Elements associated with a Command
  • 47. So far.. 05/28/10 Command #1 Tag = “Edit Copy” OnExecute = OnCopy OnUpdate = UpdateCopyCommand Two items: mnuEditCopy tlbMain.Buttons[4] All we have done so far is store information…
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53. CommandExecutor 05/28/10 Enable() is abstract. Toolbar and Menu subclasses must define how Enable needs to work.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.

Hinweis der Redaktion

  1. 13 November 2008
  2. Note: In the RemoteControl example, each Command wrapped a Receiver object and told the Reciever to do something. In this example, the Command is given the logic externally. 13 November 2008
  3. Possible Side Discussion on Factory? 13 November 2008