Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Façade Design Pattern (1) –A structural design pattern.

Slides:



Advertisements
Similar presentations
Chapter 14 Functions. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display Function Smaller, simpler, subcomponent.
Advertisements

©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
JDBC Session 4 Tonight: Design Patterns 1.Introduction To Design Patterns 2.The Factory Pattern 3.The Facade Pattern Thursday & Next Tuesday: Data Access.
Design Pattern: Mediator Mediator Modified from Kyle Kimport’s: Design Patterns: Mediator Design Patterns: Mediator Ref:
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Composite Design Pattern (1) –A structural design pattern.
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.
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 © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Design Patterns.
Chapter 8 Object Design Reuse and Patterns. Finding Objects The hardest problems in object-oriented system development are: –Identifying objects –Decomposing.
Copyright © The McGraw-Hill Companies, Inc
Façade Design Pattern Source: Design Patterns – Elements of Reusable Object- Oriented Software; Gamma, et. al.
Chapter 22 Object-Oriented Design
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Proxy Design Pattern (1) –A structural design pattern.
Design Patterns Ric Holt & Sarah Nadi U Waterloo, March 2010.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 2 Image Slides.
Informatics 122 Software Design II Lecture 6 Emily Navarro Duplication of course material for any commercial purpose without the explicit written permission.
Chapter 8 Traffic-Analysis Techniques. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 8-1.
Seven Habits of Effective Pattern Writers Facade Pattern PH pp GoF pp John Klacsmann.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Factory Method Design Pattern (1) –A creational design.
Design Patterns.
P ATTERN H ATCHING : C H. 5 G O F: F AÇADE P ATTERN Josh Mason 6/29/2009.
A Behavior Object Pattern
CS 325: Software Engineering March 17, 2015 Applying Patterns (Part A) The Façade Pattern The Adapter Pattern Interfaces & Implementations The Strategy.
SOFTWARE DESIGN AND ARCHITECTURE
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. C H A P T E R T E N Event-Driven Programming.
Design Patterns Part two. Structural Patterns Concerned with how classes and objects are composed to form larger structures Concerned with how classes.
The Adapter Pattern SE-2811 Dr. Mark L. Hornick 1.
17.16 Synthesis of Thyroid Hormone (TH) Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Slide number: 1.
Design Patterns CSCI 5801: Software Engineering. Design Patterns.
L11-12: Design Patterns Definition Iterator (L4: Inheritance)‏ Factory (L4: Inheritance)‏ Strategy (L5: Multiple Inheritance)‏ Composite (L6: Implementation.
Facade Introduction. Intent Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the.
CS 210 Adapter Pattern October 19 th, Adapters in real life Page 236 – Head First Design Patterns.
The Façade Pattern SE-2811 Dr. Mark L. Hornick 1.
Structural Design Patterns
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns IV Structural Patterns.
08 - StructuralCSC4071 Structural Patterns concerned with how classes and objects are composed to form larger structures –Adapter interface converter Bridge.
Structural Patterns1 Nour El Kadri SEG 3202 Software Design and Architecture Notes based on U of T Design Patterns class.
OO Methodology Elaboration Iteration 2 - Design Patterns -
FacadeDesign Pattern Provide a unified interface to a set of interfaces in a subsystem. Defines a high level interface that makes the subsystem easier.
Design Patterns Software Engineering CS 561. Last Time Introduced design patterns Abstraction-Occurrence General Hierarchy Player-Role.
More Design Patterns From: Shalloway & Trott, Design Patterns Explained, 2 nd ed.
1 Chapter 5:Design Patterns. 2 What are design pattern?  Schematic description of design solution to recurring problems in software design and,  Reusable.
JAVA DESIGN PATTERN Structural Patterns - Facade Pattern Presented by: Amit kumar narela Ise Ise
1 Advanced Object-oriented Design – Principles and Patterns Structural Design Patterns.
The Facade Pattern (Structural) ©SoftMoore ConsultingSlide 1.
Watching the movie the hard way…. Page 256 – Head First Design Patterns.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Broker Design Patterns: Façade and Mediator.
Seung Ha.  Façade is generally one side of the exterior of a building, especially the front.  Meaning “frontage” or “face”  In software architecture,
CS 350 – Software Design The Adapter Pattern – Chapter 7 Gang of Four Definition: Convert the interface of a class into another interface that the client.
An object's behavior depends on its current state. Operations have large, multipart conditional statements that depend on the object's state.
CS 350 – Software Design The Facade Pattern – Chapter 6 Many design patterns are catalogued in the “Gang of Four” text. I find their definitions not to.
Chapter 13 Transportation Demand Analysis. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display
CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Design Patterns – Group 2 Iterator, Proxy, Adapter, Decorator.
Facade Pattern Jim Fawcett CSE776 – Design Patterns Summer 2010
Presented by FACADE PATTERN
BTS530: Major Project Planning and Design
Façade Pattern:.
GoF Patterns (GoF) popo.
MPCS – Advanced java Programming
Software Design & Documentation
Chapter Six The Facade Pattern
Design Pattern: Facade
Facade Pattern Jim Fawcett CSE776 – Design Patterns Summer 2010
Decorator Design Pattern
CS 350 – Software Design The Facade Pattern – Chapter 6
Design Patterns Satya Puvvada Satya Puvvada.
Object Oriented Design Patterns - Structural Patterns
10. Façade Pattern SE2811 Software Component Design
Software Design Lecture : 35.
Presentation transcript:

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Façade Design Pattern (1) –A structural design pattern Decouples interface from implementation –Intent To provide a unified interface to a set of interfaces in a subsystem To simplify an existing interface Defines a higher-level interface that makes the subsystem easier to use

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Façade Design Pattern (2) –Problem Situation I: Wish to simplify a process for most clients –Subsystems are built for multiple applications –Most applications use only a small subset –Most applications interact in a predefined manner Situation II: Wish to reduce the number of dependencies between client and implementation classes –Requires an interface that allows a level of isolation Situation III: Wish to build a layered software design with all inter-layer communication between interfaces

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Façade Design Pattern (3) –Non-software example Customer Service Representative –Provides a unified interface to each of the departments involved in a transaction

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Façade Design Pattern (4) –Abstract Description Object Design Pattern Most clients use façade to achieve desired results –Façade can be bypassed for more complex access Client

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Façade Design Pattern (5) –Consequences Shields clients from subsystem complexity Promotes weak coupling between clients and subsystems –Easier to swap out alternatives Allows more advanced clients to by- pass and have direct subsystem access

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Façade Design Pattern (6) –Implementation Issues Can involve nontrivial manipulation of subsystem –May require several steps in sequence or composition –May require temporary storage Can completely hide subsystem –Place subsystem and façade in package –Make façade only public class –Can be difficult if subsystem objects returned to client Can implement Façade as abstract class –Allows different concrete facades under same interface

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Façade Design Pattern (7) –Example: Tic-Tac-Toe When a player wants to make a move it must tell: –the “board” to make such a move –the “control manager” to set up for next turn (halt the game, skip a turn, change players, …) –The “view administrator” to announce the winner, loser, or draw if the game is over To avoid this complication, player interacts with a single interface IGame (the façade)

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Façade Design Pattern (8) –Example: Tic-Tac-Toe public abstract class APlayer { protected IGame game; public APlayer(IGame g, …){ this.game = g; … } public class ComputerPlayer extends APlayer { … public void takeTurn() { … getGame().takePosition(p.x, p.y, this, …); } Handles all the details.

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Façade Design Pattern (9) –Second Example: Data Access Object Data Access Object Data Manager

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Façade Design Pattern (10) –Common Variations Key: Don’t add new behavior, just simplify interface to existing behavior –Java API Usage java.net.URL –client can use it without being aware of classes that allow it to work –client can use classes like URLConnection directly if they choose

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Façade Design Pattern (11) –Adapter & Façade are often compared Common misperception –Façade deals with multiple classes and Adapter deals with one Adapter converts an interface and façade simplifies one FacadeAdapter Are there preexisting classes?Yes Is there an interface we must design to?NoYes Does an object need to behave polymorphically? NoProbably Is a simpler interface needed?YesNo