{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ch08lect3_UD - Object-Oriented Software Engineering Using...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 8, Object Design: Design Patterns II Using UML, Patterns, and Java Object-Oriented Software Engineering
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Bernd Bruegge & Allen H. Dutoit             Object-Oriented Software Engineering: Using UML, Patterns, and Java                                        2 A Taxonomy of Design Patterns
Background image of page 2
Bernd Bruegge & Allen H. Dutoit             Object-Oriented Software Engineering: Using UML, Patterns, and Java                                        3 The Proxy Pattern: 3 Types Caching of information  (“Remote Proxy”) The Proxy object is a local representative for an object in a different  address space Good if information does not change too often Standin   (“Virtual Proxy”) Object is too expensive to create or too expensive to download.  Good if the real object is not accessed  too often Example: RealImage and ImageProxy Access control   (“ Protection Proxy”) The proxy object provides protection for the real object Good when different actors should have different access and viewing  rights for the same object  Example: Grade information accessed by administrators, teachers  and students.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Bernd Bruegge & Allen H. Dutoit             Object-Oriented Software Engineering: Using UML, Patterns, and Java                                        4 Command Pattern: Motivation You want  to build a user interface  You want to provide menus You want to make the menus reusable across many  applications The applications only know what has to be done when a command  from the menu is selected  You don’t want to hardcode the menu commands for the various  applications Such a user interface can easily be implemented with the  Command Pattern.  
Background image of page 4
Command Pattern Client (in this case a user interface builder) creates a ConcreteCommand and binds it to an action  operation in Receiver  Client hands the ConcreteCommand over to the Invoker which stores it (for example in a menu) The Invoker has the responsibility to execute or undo a command (based on a string entered by the  user) Command execute() Receiver action1() action2() Client Invoker ConcreteCommand1 execute() «binds» ConcreteCommand2 execute() «binds»
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Bernd Bruegge & Allen H. Dutoit             Object-Oriented Software Engineering: Using UML, Patterns, and Java                                        6 Comments to the Command Pattern The Command abstract class declares the interface  supported by all ConcreteCommands. 
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}