Facade Pattern Jim Fawcett CSE776 – Design Patterns Summer 2010

Slides:



Advertisements
Similar presentations
JDBC Session 4 Tonight: Design Patterns 1.Introduction To Design Patterns 2.The Factory Pattern 3.The Facade Pattern Thursday & Next Tuesday: Data Access.
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.
Chapter 8 Object Design Reuse and Patterns. Finding Objects The hardest problems in object-oriented system development are: –Identifying objects –Decomposing.
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.
Seven Habits of Effective Pattern Writers Facade Pattern PH pp GoF pp John Klacsmann.
Creational Patterns Making Objects The Smart Way Brent Ramerth Abstract Factory, Builder.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Façade Design Pattern (1) –A structural design pattern.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse.
Design Patterns.
Case Studies on Design Patterns Design Refinements Examples.
SOFTWARE DESIGN AND ARCHITECTURE
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
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.
Facade Introduction. Intent Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the.
Software Design Patterns (1) Introduction. patterns do … & do not … Patterns do... provide common vocabulary provide “shorthand” for effectively communicating.
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.
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 EE Patterns Dan Bugariu.  What is Java EE ?  What is a Pattern ?
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.
Seung Ha.  Façade is generally one side of the exterior of a building, especially the front.  Meaning “frontage” or “face”  In software architecture,
CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym.
Facade Pattern Jim Fawcett CSE776 – Design Patterns Summer 2010
Presented by FACADE PATTERN
Design Patterns: MORE Examples
Mediator Design Pattern
Abstract Factory Pattern
Factory Method Pattern
Strategy Pattern Jim Fawcett CSE776 – Design Patterns Fall 2014.
Façade Pattern:.
GoF Patterns (GoF) popo.
MPCS – Advanced java Programming
Design Patterns Lecture part 2.
Software Design & Documentation
By SmartBoard team Adapter pattern.
Introduction to Design Patterns
Factory Method Pattern
object oriented Principles of software design
Abstract Factory Pattern
Decorator Design Pattern
CS 350 – Software Design The Facade Pattern – Chapter 6
Intent (Thanks to Jim Fawcett for the slides)
Presented by Igor Ivković
More Design Patterns 1.
Design Patterns Satya Puvvada Satya Puvvada.
More Design Patterns 1.
Jim Fawcett CSE776 – Design Patterns Summer 2003
Informatics 122 Software Design II
Object Oriented Design Patterns - Structural Patterns
Ms Munawar Khatoon IV Year I Sem Computer Science Engineering
SAMANVITHA RAMAYANAM 18TH FEBRUARY 2010 CPE 691
Structural Patterns: Adapter and Bridge
10. Façade Pattern SE2811 Software Component Design
Informatics 122 Software Design II
Chapter 8, Design Patterns Introduction
Presented by Igor Ivković
Adapter Pattern Jim Fawcett
defines a higher-level interface that makes a subsystem easier to use
Adapter Pattern Jim Fawcett
Message Passing Systems
Strategy Pattern Jim Fawcett CSE776 – Design Patterns Fall 2014.
Presentation transcript:

Facade Pattern Jim Fawcett CSE776 – Design Patterns Summer 2010 Source: Joint presentation by Yu Zhu & Jim Fawcett, Summer 2009

Intent “Provide a unified interface to a set of interfaces in a collection of subsystems. Facade defines a higher-level interface that makes the subsystems easier to use.”

Facade Examples http://www.ecs.syr.edu/faculty/fawcett/handouts/webpages/FawcettHome.htm Parser (CSE681, CSE687) is façade for rules and actions PeopleSoft presents façade for many applications: Registration Payroll Yada yada

Motivation “Common design goal is to minimize the communication and dependencies between subsystems. One way to achieve this goal is to introduce a facade object that provides a single, simplified interface to the more general facilities of a subsystem.” With façade clients don't have to be concerned with exactly which object in a subsystem they're dealing with. They just call methods on the facade in blissful ignorance.

Motivation

Motivation Compiler subsystem: Some language tools might need to access these classes directly. But most clients merely want to compile some code. Dealing with these low-level interfaces would only complicate their work

Compiler Facade

Communicator Facade

Facade for legacy application Modeling a legacy application by its basic functions: create, read, update, and delete and exposing these functions as Web methods, Web service facade allows other applications to access legacy data by making use of common Web services through standard protocols Facade decouples layers so that they do not depend on each other which can make it easier to develop, to use and to promote code re-use

Applicability Use the Facade pattern when: clients only need a simple default view of the subsystems. Only clients needing more customizability will need to look beyond the facade. decouple the subsystem from clients and other subsystems layer subsystems Facade may not try to hide low-level functionality completely.

Structure

Participants Facade (Compiler) Subsystem classes (Scanner, Parser…) knows which subsystem classes are responsible for a request delegates client requests to appropriate subsystem objects Subsystem classes (Scanner, Parser…) implement subsystem functionality handle work assigned by Facade object have no knowledge of the facade; that is, they keep no reference to it

Collaborations Facade forwards the clients’ requests to the appropriate subsystem objects. Subsystem objects perform the actual work. Façade may add some functionality of its own. Facade has to translate its interface to subsystem interfaces. Clients don’t have to access subsystem objects directly

Consequences The Facade pattern offers the following benefits: It shields clients from subsystem components. It promotes weak coupling between the subsystem and its clients. help layer a system and the dependencies between objects. reduce compilation dependencies. simplify porting systems to other platforms. It doesn’t prevent applications from using subsystem classes

Implementation Can further decouple clients and subsystem by making Facade an abstract class with concrete subclasses for different implementations of a subsystem. Alternative: Configure a Facade object with different subsystem objects.

Implementation Public versus private subsystem classes. Public interface to a subsystem consists of classes that all clients can access; private interface is just for subsystem extenders. Facade class is part of the public interface. It may use private interfaces provided by subsystems (if they grant friendship)

Know Uses Almost every system you ever designed Socket communicator shown earlier SU’s version of People-Soft accessed through mySlice Facade. ET++: ProgrammingEnvironment for browsing tools Virtual memory framework: Domain for address spaces

Virtual Memory Framework

Advantages Facade can make a software library easier to use and understand since the facade has convenient methods for common tasks. It can reduce dependencies of outside code on the inner workings of a library since most code uses the facade.  This allows for more flexibility in developing a system using library. Facade can wrap a poorly designed collection of APIs with a single well-designed API.

Related Patterns An adapter wraps an object to change its interface, a decorator wraps an object to add new behaviors and responsibilities, and a facade "wraps" a set of objects to simplify. Abstract Factory can be used to provide an interface for creating subsystem objects. Mediator abstracts functionality of existing classes. Mediator message flow is more complex than Facade. Facade objects may be Singletons.

Questions Façade is obvious! Why include in Pattern catalog?