Oct 200291.3913 R McFadyen1 Facade P. 368+ Problem: There are a set of classes, a subsystem, that you need to interact with for some purpose, but you don’t.

Slides:



Advertisements
Similar presentations
Winter 2007ACS-3913 Ron McFadyen1 Also known as publish/subscribe The essence of this pattern is that one or more objects (called observers or listeners)
Advertisements

Figures – Chapter 7.
Chapter 7 – Object-Oriented Design
OOP Design Patterns Chapters Design Patterns The main idea behind design patterns is to extract the high level interactions between objects and.
March R McFadyen1 Architecture Architecture involves the set of significant decisions about the organization of a software system, decisions.
Oct R McFadyen1 Recall UML Class Diagram BusRoute BusStopList BusStop BusList BusPersonList Person passengers buses busStops waiting 0..*
Feb R. McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Pronunciation: -"fi-z&m Function:
December Ron McFadyen1 sf:SaleFrame1s:Salepropertylisteners:Object initialize(s:Sale) attach(sf) add (sf) Figure Replace addPropertyListener.
March Ron McFadyen1 Observer P Also known as Publish-Subscribe Applied in order to implement the Model-View Separation principle (see.
Fall 2009ACS-3913 Ron McFadyen1 Observer Problem: There are many objects (subscribers) needing to know of the state changes, or events, of another object.
MVC Nick Lopez Duplication of course material for any commercial purpose without the explicit written permission of the professor is prohibited.
Spring 2010ACS-3913 Ron McFadyen1 Weather Station Page 39+ In this application, weather station devices supply data to a weather data object. As the data.
Chapter 9 Problems TC 1, 2. TC 1 Solution is to create an adapter that adapts calls from the payroll system to the payroll tax subsystem. TaxCalcAdapter.
Nov Ron McFadyen1 Figure The Observer Pattern in a DCD.
Nov Ron McFadyen1 Observer P Problem: There are many objects (subscribers) needing to know of the state changes, or events, of another.
Winter 2012ACS-3913 Ron McFadyen1 Model View Controller Originated with Smalltalk development (1979) Separates a system’s classes into View, Controller,
March R McFadyen1 Façade. March R McFadyen2 Facade P Main Entry: fa·cade Variant(s): also fa·çade / f&-'säd/ Function: noun.
Graphical User Interface (GUI) Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Nov 5, Ron McFadyen1 Observer Pattern Objects that participate in the observer pattern must either be publishers (subject) or subscribers (observers)
Winter 2007ACS-3913 Ron McFadyen1 Observer Pattern Problem: There are many objects (observers / subscribers) needing to know of the state changes, or events,
GRASP : Designing Objects with Responsibilities
Object-Oriented Analysis and Design
Façade Design Pattern Source: Design Patterns – Elements of Reusable Object- Oriented Software; Gamma, et. al.
1 Observer Design Pattern By Eric Perret Pages in Applying UML and Patterns.
March Ron McFadyen1 Observer Problem: There are many objects (subscribers) needing to know of the state changes, or events, of another object.
March R McFadyen1 Figure 30.2 Layers in NextGen They only have three layers in this architecture Each layer is shown as a UML Package No separate.
Presentation 4: IBM Rational Software Architect Example James Martin CpE 691, Spring 2010 February 18, 2010.
Chapter 26 Applying Gang of Four Design Patterns 1CS6359 Fall 2012 John Cole.
Design Patterns Ric Holt & Sarah Nadi U Waterloo, March 2010.
Client/Server Software Architectures Yonglei Tao.
Objectives Design Class Diagrams Issues in system design Generalization Review UML papers.
Dependency Injection and Model-View-Controller. Overview Inversion of Control Model-View-Controller.
Design Patterns Alan Shalloway, James Trott, Design Patterns Explained, Addison-Wesley, Gamma, Helm, Johnson, Vlissides, Design Patterns, Elements.
Chapter 13 Starting Design: Logical Architecture and UML Package Diagrams.
MVC pattern and implementation in java
Systems Analysis and Design in a Changing World, Fifth Edition
MVC and MVP. References enter.html enter.html
CSSE 374: 3½ Gang of Four Design Patterns These slides derived from Steve Chenoweth, Shawn Bohner, Curt Clifton, and others involved in delivering 374.
Systems Analysis and Design in a Changing World, 6th Edition
12 Systems Analysis and Design in a Changing World, Fifth Edition.
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
Chapter 26 GoF Design Patterns. The Adapter Design Pattern.
1 ITEC 3010 “Systems Analysis and Design, I” LECTURE 10: Use Case Realizations [Prof. Peter Khaiter]
(c) University of Washington08-1 CSC 143 Models and Views Reading: Ch. 18.
GoF Design Patterns (Ch. 26). GoF Design Patterns Adapter Factory Singleton Strategy Composite Façade Observer (Publish-Subscribe)
Chapter 13 Logical Architecture and UML Package Diagrams 1CS6359 Fall 2012 John Cole.
Object Oriented Design Jerry KotubaSYST Object Oriented Methodologies1.
Gang of Four Patterns 23 total 15 useful How are they different from GRASP Patterns?
Observer Design Pattern
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
1 CSE 331 Model/View Separation and Observer Pattern slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia.
Oct R McFadyen1 Observer Pattern Example From: Designed Patterns Explained by Shalloway & Trott; Addison-Wesley; P Observers: objects.
L10: Model-View-Controller General application structure. User Interface: Role, Requirements, Problems Design patterns: Model – View – Controller, Observer/Observable.
The Observer Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
Oct 3, Ron McFadyen1 GRASP Patterns 1.Expert 2.Creator 3.Controller 4.Low Coupling 5.High Cohesion.
Presented by Alexey Vedishchev Developing Web-applications with Grails framework American University of Nigeria, 2016 Intro To MVC Architecture.
Patterns An Easier Way to Think About Common Software Designs This presentation is licensed under a Creative Commons License.
Unit IV: GoF Design Patterns
Design Pattern: Facade
Observer Design Pattern
MVC and Design Patterns
Facade From Main Entry: fa·cade Variant(s): also fa·çade /f&-'säd/ Function: noun Etymology: French façade, from Italian facciata,
BTS530: Major Project Planning and Design
GoF Design Patterns (Ch. 26). GoF Design Patterns Adapter Factory Singleton Strategy Composite Façade Observer (Publish-Subscribe)
GoF Design Patterns (Ch. 26)
Figure 30.2 Layers in NextGen
Model-View-Controller Patterns and Frameworks
Model-View-Controller (MVC) Pattern
Starting Design: Logical Architecture and UML Package Diagrams
GoF Design Patterns (Ch. 26)
Presentation transcript:

Oct R McFadyen1 Facade P Problem: There are a set of classes, a subsystem, that you need to interact with for some purpose, but you don’t want to create dependencies on this subsystem. Solution: Create a class that wraps this subsystem. The wrapper will define an interface that hides the details (classes, methods) of the subsystem. The façade is a “front-end” object that defines a single point of entry to the subsystem’s services. Showing the classes as a package (a subsytem) A façade, a wrapper

Oct R McFadyen2 Facade :ClassX:Facade msg2 (…) msg1()......

Oct R McFadyen3 To create a simpler interface: number of methods, number of objects one has to deal with All requests to go through a Façade class, one can easily track usage To facilitate subsystem replacement – only one class is affected, the Façade class. This is the motivation in Larman’s example.

Oct R McFadyen4 Observer P Also known as Publish-Subscribe Applied in order to implement the Model-View Separation principle (see pages 471+) model and view are separated non-GUI objects are not directly coupled to GUI components domain objects are not directly coupled to window objects same as Model-View-Controller (MVC) principle that came from Smalltalk

Oct R McFadyen5 Observer Problem: There are many objects (subscribers) needing to know of the state changes, or events, of another object (publisher), and we want to keep the coupling low. Solution: Define a subscriber or listener interface that is implemented by the subscribers.

Oct R McFadyen6 Figure the display must reflect the correct total There is a requirement for a window to be updated whenever the total value of the sale changes

Oct R McFadyen7 Figure The Observer Pattern in a DCD

Oct R McFadyen8 Figure The Observer Pattern in a DCD Note: SaleFrame1 is-a Jframe SaleFrame1 implements the PropertyListener interface – it has an update method (onPropertyEvent) Note: Since a SaleFrame1 sends the add msg, there is a dependency of SaleFrame1 on Sale

Oct R McFadyen9 Figure The Observer Pattern in a DCD Note: A Sale will know when it has changed, and that it must notify its observers

Oct R McFadyen10 Figure The Observer Pattern in a DCD Note: A Sale will send messages to its many observers

Oct R McFadyen11 Figure a window subscribing When a SaleFrame1 (the subscriber) is initialized, it subscribes to the Sale (the publisher)

Oct R McFadyen12 Figure a sale publishing a change A Sale receives a message changing its state. The Sale invokes its method, publishPropertyEvent, which will in turn notify any subscribers of the change Note the activations for the sale

Oct R McFadyen13 Figure a window receiving notification The window receives notification of the state change and modifies its display appropriately Notice that this is a continuation from the previous sequence diagram