10. Façade Pattern SE2811 Software Component Design

Slides:



Advertisements
Similar presentations
PATTERNS -STRUCTURAL PATTERNS WATTANAPON G SUTTAPAK Software Engineering, School of Information Communication Technology, University of PHAYAO 1.
Advertisements

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.
Façade Design Pattern Source: Design Patterns – Elements of Reusable Object- Oriented Software; Gamma, et. al.
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
Design Patterns academy.zariba.com 1. Lecture Content 1.What are Design Patterns? 2.Creational 3.Structural 4.Behavioral 5.Architectural 6.Design Patterns.
Design Patterns Ric Holt & Sarah Nadi U Waterloo, March 2010.
Client/Server Software Architectures Yonglei Tao.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Façade Design Pattern (1) –A structural design pattern.
Design Patterns.
SOFTWARE DESIGN AND ARCHITECTURE
Design Patterns: Structural Design Patterns
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
The Adapter Pattern SE-2811 Dr. Mark L. Hornick 1.
Design Patterns CSCI 5801: Software Engineering. Design Patterns.
The Factory Patterns SE-2811 Dr. Mark L. Hornick 1.
L11-12: Design Patterns Definition Iterator (L4: Inheritance)‏ Factory (L4: Inheritance)‏ Strategy (L5: Multiple Inheritance)‏ Composite (L6: Implementation.
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.
Week 2, Day 2: The Factory Method Pattern Other good design principles Cohesion vs. Coupling Implementing the Strategy Pattern Changing strategies (behaviors)
Week 6, Class 1 & 2: Decorators Return Exam Questions about lab due tomorrow in class? Threads Locking on null object invokeLater & the squares example.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns IV Structural Patterns.
Week 9, Class 3: Model-View-Controller Today Happens-Before Adapter and Façade Pattern (high-level) Tuesday: Project code due, 11pm Wednesday: Quiz Choose.
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.
FacadeDesign Pattern Provide a unified interface to a set of interfaces in a subsystem. Defines a high level interface that makes the subsystem easier.
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.
Adapter and Façade Patterns By Wode Ni and Leonard Bacon-Shone.
Example to motivate discussion We have two lists (of menu items) one implemented using ArrayList and another using Arrays. How does one work with these.
Watching the movie the hard way…. Page 256 – Head First Design Patterns.
CS 210 Proxy Pattern Nov 16 th, RMI – A quick review A simple, easy to understand tutorial is located here:
CS 5150 Software Engineering Lecture 16 Program Design 3.
Design Patterns: Structural Design Patterns General and reusable solutions to common problems in software design Software University
An object's behavior depends on its current state. Operations have large, multipart conditional statements that depend on the object's state.
Model-View-Controller A Design Pattern SE-2030 Dr. Rob Hasker 1 Based on slides written by Dr. Mark L. Hornick Used with permission.
Week 5, Class 3: Decorators Lab questions? Example: Starbuzz coffee Basic Pattern More examples Design Principles Compare with alternatives SE-2811 Slide.
Facade Pattern Jim Fawcett CSE776 – Design Patterns Summer 2010
Presented by FACADE PATTERN
Software Design Refinement Using Design Patterns
Object-Orientated Analysis, Design and Programming
Façade Pattern:.
MPCS – Advanced java Programming
Design Patterns Lecture part 2.
Week 2, Day 1: The Factory Method Pattern
By SmartBoard team Adapter pattern.
Instructor: Dr. Hany H. Ammar
Composite Pattern SE2811 Software Component Design
Facade Pattern Jim Fawcett CSE776 – Design Patterns Summer 2010
object oriented Principles of software design
Decorator Design Pattern
Presented by Igor Ivković
Chapter 8, Object Design Introduction to Design Patterns
7. Decorator, Façade Patterns
SE-2811 Software Component Design
Object Oriented Design Patterns - Structural Patterns
Week 7, Class 1: The Command Pattern (cont.)
SE-2811 Software Component Design
SE2811 Software Component Design Dr. Rob Hasker
Structural Patterns: Adapter and Bridge
7. Decorator, Façade Patterns
8. Observer Pattern SE2811 Software Component Design
14. Factory Pattern SE2811 Software Component Design
SE2811 Software Component Design Dr. Rob Hasker
13. Composite Pattern SE2811 Software Component Design
14. Factory Pattern SE2811 Software Component Design
Software Design Lecture : 35.
13. Composite Pattern SE2811 Software Component Design
Chapter 8, Design Patterns Introduction
Adapter Pattern Jim Fawcett
Adapter Pattern Jim Fawcett
Presentation transcript:

10. Façade Pattern SE2811 Software Component Design Dr. Rob Hasker (based on slides by Dr. Mark Hornick) 10. Façade Pattern

Recall: Adapter (Wrapper) Pattern Existing System Adapter Implements the interface your classes expect Uses the vendor interface to service your requests. Vendor2 Class Existing System Vendor2 Class Adapter

The Adapter configuration 1. The original ServiceProvider class is obsolete and discarded new methods 2. An interface declaring the same methods as the original ServiceProvider is created. 3. A replacement class for the original similar functionality but with a the adaptee

But suppose you want to watch a Movie... Use multiple interfaces (remotes) to Turn on Receiver/amplifier Turn on TV/Monitor Turn on DVD player Set the Receiver input to DVD Put the Monitor in HDMI input mode Set the Receiver volume to medium Set Receiver to DTS Surround Start the DVD player. Interacting with the following classes: Receiver/Amplifier TV/Monitor DVD

To decrease the complexity… New class: TheaterFacade For instance: a media controller Exposes a few methods such as watchMovie() The façade treats the various components as a sub system and calls on them to implement the watchMovie method. To watch a movie, we just call one method, watchMovie and it communicates with the Monitor, DVD, and Receiver for us The façade still leaves the subsystem accessible to be used directly If you need the advanced functionality of the subsystem classes, they are available for use

The Problem Complex system Difficult for clients (blue) to deal with Multiple subsystems Each with its own interface Each with many methods Difficult for clients (blue) to deal with 6

Façade Solution Solution Centralize subsystem interface Simplify/reduce number of centralized methods Façade presents new unified “face” to clients Facade 7

Removing the burden from beginning Java developers with a Façade (WinPlotter)

Example: Vehicle sales prep

Example: Vehicle sales prep What cohesion does VehicleFacade exhibit? Is this a problem? answer: procedural

Generic Pattern

Façade Consequences Shields clients from subsystem components Make subsystem easier to use Reduces coupling from client to subsystem classes Allow internal classes to change freely Permit “layering” of system function Level of client-subsystem coupling Make Facade an abstract class Different concrete subclasses for different implementations of the subsystem Configure the façade object with different subsystem objects 12

Façade Applications Interface to existing library Unify or “clean up” complex interface Design layered system Various service levels Façade abstracts interface of each level Provide abstract interfaces To alternative implementations 13

Three patterns... Façade Adapter Proxy - later Provide “clean” interface Underlying operations still available Adapter Conform interface to a specific client Adapt new set of classes to old Stabilize interface to library under development Proxy - later Interface to remote client or controlled access to a resource Underlying operations not available 14

Review Façade: clean interface to complex subsystems Decorator (previous notes): adding properties to objects without using inheritance Composition Over Extension principle