ch08lect3_UD - Chapter 8, Object Design: Design Patterns II...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Chapter 8, Object Design: Design Patterns II Using UML, Patterns, and Java Object-Oriented Software Engineering Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 2 A Taxonomy of Design Patterns 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. 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. 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» 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. • The client is a class in a user interface builder or in a class...
View Full Document

This note was uploaded on 02/19/2011 for the course CS 319 taught by Professor Ugurdogrusoz during the Fall '10 term at Bilkent University.

Page1 / 26

ch08lect3_UD - Chapter 8, Object Design: Design Patterns II...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online