© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Broker Design Patterns: Façade and Mediator.

Slides:



Advertisements
Similar presentations
Unit 7 Generic Interfaces and Encapsulation, a Class in the Middle Kirk Scott.
Advertisements

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Generator Design Patterns: The Factory Patterns.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 6- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 2- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 4- 1.
A Behavioral Pattern. Problem: Simple enough right? Object.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 9- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 18 Indexing Structures for Files.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Object, Object- Relational, and XML: Concepts, Models, Languages,
Façade Pattern Jeff Schott CS590L Spring What is a façade? 1) The principal face or front of a building 2) A false, superficial, or artificial appearance.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Winter 2011ACS Ron McFadyen1 Façade A façade simplifies access to a related set of objects by providing one object that all objects outside the.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Façade Design Pattern Source: Design Patterns – Elements of Reusable Object- Oriented Software; Gamma, et. al.
Chapter 22 Object-Oriented Design
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 Part 1 Conditionals and Loops.
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
Design Patterns Ric Holt & Sarah Nadi U Waterloo, March 2010.
Seven Habits of Effective Pattern Writers Facade Pattern PH pp GoF pp John Klacsmann.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Interaction Design Process and Heuristics.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Façade Design Pattern (1) –A structural design pattern.
BY VEDASHREE GOVINDA GOWDA
Dependency Injection and Model-View-Controller. Overview Inversion of Control Model-View-Controller.
The Design Discipline.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Engineering Design Resolution & Design Principles.
SOFTWARE DESIGN AND ARCHITECTURE
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Reactor Design Patterns: Command and Observer.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 11.9 Curvature and Normal Vectors.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Architectural Styles.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 11.5 Lines and Curves in Space.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 4 Applications of the Derivative.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1 Functions.
Design Patterns CSCI 5801: Software Engineering. Design Patterns.
GRASP: Designing Objects with Responsibilities
Facade Introduction. Intent Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the.
FacadeDesign Pattern Provide a unified interface to a set of interfaces in a subsystem. Defines a high level interface that makes the subsystem easier.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 5 Integration.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 11.6 Calculus of Vector-Valued Functions.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Mid-Level Design Patterns: Iteration and Iterators.
The Mediator Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
The Facade Pattern (Structural) ©SoftMoore ConsultingSlide 1.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Mid-Level Design Patterns Categories.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Broker Design Patterns: Adapters and Proxy.
Facade Pattern Jim Fawcett CSE776 – Design Patterns Summer 2010
Presented by FACADE PATTERN
Façade Pattern:.
MPCS – Advanced java Programming
© 2015 Pearson Education, Inc.
Introduction to Design Patterns
Design Pattern: Facade
© 2015 Pearson Education, Inc.
Part 3 Design What does design mean in different fields?
Facade Pattern Jim Fawcett CSE776 – Design Patterns Summer 2010
object oriented Principles of software design
Object Oriented Design Patterns - Structural Patterns
defines a higher-level interface that makes a subsystem easier to use
Presentation transcript:

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Broker Design Patterns: Façade and Mediator

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2 Objectives  To present the structure, behavior, and characteristics of broker patterns  To present the Façade and Mediator design patterns

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 3 Topics  Broker patterns  The Façade pattern  The Mediator pattern

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4 Broker Pattern Structure  The Client must access the Broker and the Broker must access the Supplier  Most Broker patterns elaborate this basic structure

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5 Broker Pattern Behavior

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6 Broker Pattern Advantages  Simplify the Supplier—A Broker can augment the Supplier’s services.  Decompose the Supplier—A complex Supplier can offload some of its responsibilities to a Broker.  Facilitate Client/Supplier Interaction—A Broker may present a different interface, handle interaction details, etc.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7 Broker Example: Iterator Form

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 8 Broker Example: Iterator Behavior

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 9 The Façade Pattern  The Façade pattern eases interaction between a client and a sub-system of suppliers by providing a simpler interface to the sub-system.  The broker class is a façade that provides simplified sub-system services to clients.  Analogy: a travel agent

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 10 Façade Pattern Structure

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 11 Façade Examples  Interface to a compiler  Interface to a user interface (from the application side)  Interface to a memory management system

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 12 When to Use a Façade  Use the Façade pattern when there is a need to provide a simplified interface to a complex sub-system.  Façades can also help decouple systems. If the façade mediates all interaction with a client, then the sub-system can be changed without affecting the client.  A façade may work like an adapter by providing a new interface to a sub-system (adapters are discussed later).

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 13 The Mediator Pattern  The Mediator pattern reduces coupling and simplifies code when several objects must negotiate a complex interaction.  Classes interact only with a mediator class rather than with each other.  Classes are coupled only to the mediator where interaction control code resides.  Mediator is like a multi-way Façade pattern.  Analogy: a meeting scheduler

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 14 Using a Mediator

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 15 Mediator Pattern Structure

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 16 Mediator as a Broker

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 17 Mediator Behavior

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 18 When to Use a Mediator  Use the Mediator pattern when a complex interaction between collaborators must be encapsulated to Decouple collaborators, Centralize control of an interaction, and Simplify the collaborators.  Using a mediator may compromise performance.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 19 Mediators, Façades, and Control Styles  The Façade and Mediator patterns provide means to make control more centralized.  The Façade and Mediator patterns should be used to move from a dispersed to a delegated style, but not from a delegated to a centralized style.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 20 Summary  Broker patterns use a Broker class to facilitate the interaction between a Client and a Supplier.  The Façade pattern uses a broker (the façade) to provide a simplified interface to a complex sub-system.  The Mediator pattern uses a broker to encapsulate and control a complex interaction among several suppliers.