ECE 355 Design Patterns Tutorial Part 2 (based on slides by Ali Razavi) Presented by Igor Ivković

Slides:



Advertisements
Similar presentations
Design Patterns.
Advertisements

Observer Method 1. References Gamma Erich, Helm Richard, “Design Patterns: Elements of Reusable Object- Oriented Software” 2.
CSE3308/CSC Software Engineering: Analysis and DesignLecture 5B.1 Software Engineering: Analysis and Design - CSE3308 Patterns CSE3308/CSC3080/DMS/2000/12.
Reza Gorgan Mohammadi AmirKabir University of Technology, Department of Computer Engineering & Information Technology Advanced design.
CSE Software Engineering: Analysis and Design, 2005Lecture 8A.1 Software Engineering: Analysis and Design - CSE3308 Design and Analysis Patterns.
Observer Pattern Fall 2005 OOPD John Anthony. What is a Pattern? “Each pattern describes a problem which occurs over and over again in our environment,
CSE Software Engineering: Analysis and Design, 2002Lecture 7B.1 Software Engineering: Analysis and Design - CSE3308 Patterns CSE3308/DMS/2002/15.
Design Patterns CS is not simply about programming
Chapter 8, Object Design Introduction to Design Patterns
Spring 2010CS 2251 Design Patterns. Spring 2010CS 2252 What is a Design Pattern? "a general reusable solution to a commonly occurring problem in software.
Design Patterns Based on Design Patterns. Elements of Reusable Object-Oriented Software. by E.Gamma, R. Helm, R. Johnson,J. Vlissides.
Chapter 8 Object Design Reuse and Patterns. Finding Objects The hardest problems in object-oriented system development are: –Identifying objects –Decomposing.
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Creational Patterns Making Objects The Smart Way Brent Ramerth Abstract Factory, Builder.
BDP Behavioral Pattern. BDP-2 Behavioral Patters Concerned with algorithms & assignment of responsibilities Patterns of Communication between Objects.
Design Patterns.
Software Design Refinement Using Design Patterns Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
02 - Behavioral Design Patterns – 2 Moshe Fresko Bar-Ilan University תשס"ח 2008.
05 - Patterns Intro.CSC4071 Design Patterns Designing good and reusable OO software is hard. –Mix of specific + general –Impossible to get it right the.
Case Studies on Design Patterns Design Refinements Examples.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
Design Pattern. The Observer Pattern The Observer Pattern defines a one-to-many dependency between objects so that when one object changes state, all.
Observer Behavioral Pattern. Intent Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified.
Y2 eProjects Session 4 – Advanced Topics. Objectives  Dynamic Models  Design Patterns (Optional)  Software testing (for S4) ACCP i7.1\Sem3_4\eProject\T4.
 How are you going to collaborate?  How are you going to divide up work?  How are you going to make sure that changes work with other people’s code?
Behavioral Design Patterns Morteza Yousefi University Of Science & Technology Of Mazandaran 1of 27Behavioral Design Patterns.
Design Patterns CSCI 5801: Software Engineering. Design Patterns.
Strategy Design Patterns CS 590L - Sushil Puradkar.
Software Design Patterns (1) Introduction. patterns do … & do not … Patterns do... provide common vocabulary provide “shorthand” for effectively communicating.
CS 210 Adapter Pattern October 19 th, Adapters in real life Page 236 – Head First Design Patterns.
Unit 4 Object-Oriented Design Patterns NameStudent Number CAI XIANGHT082182A KYAW THU LINHT082238Y LI PENGFEIHT082220L NAUNG NAUNG LATTHT082195L PLATHOTTAM.
ECE450S – Software Engineering II
Design Patterns CSIS 3701: Advanced Object Oriented Programming.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns VIII Chain of Responsibility, Strategy, State.
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 13 Creational Design Pattern SWE 316: Software Design and Architecture.
Behavioural Design Patterns Quote du jour: ECE450S – Software Engineering II I have not failed. I've just found 10,000 ways that won't work. - Thomas Edison.
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 By Mareck Kortylevitch and Piotreck Ratchinsky.
Design Pattern. Definition: A design pattern is a general reusable solution to a commonly occurring problem within a given context in software design.
Manali Joshi1 The Observer Design Pattern Presented By: Manali Joshi.
BEHAVIORAL PATTERNS 13-Sep-2012 Presenters Sanjeeb Kumar Nanda & Shankar Gogada.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 31. Review Creational Design Patterns – Singleton Pattern – Builder Pattern.
Advanced Object-oriented Design Patterns Creational Design Patterns.
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.
Proxy Pattern defined The Proxy Pattern provides a surrogate or placeholder for another object to control access to it by creating a representative object.
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:
Chapter 8 Object Design Reuse and Patterns. More Patterns Abstract Factory: Provide manufacturer independence Builder: Hide a complex creation process.
CS 5150 Software Engineering Lecture 16 Program Design 3.
An object's behavior depends on its current state. Operations have large, multipart conditional statements that depend on the object's state.
Design Patterns Creational Patterns. Abstract the instantiation process Help make the system independent of how its objects are created, composed and.
OBSERVER PATTERN OBSERVER PATTERN Presented By Presented By Ajeet Tripathi ISE
The Observer Design Pattern Author :Erich Gamma, et al. Source :Elements of Reusable Object-Oriented Software Speaker : Chiao-Ping Chang Advisor : Ku-Yaw.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
Jim Fawcett CSE776 – Design Patterns Summer 2006
Design Patterns: MORE Examples
Design Patterns: Brief Examples
Strategy Design Pattern
Chapter 10 Design Patterns.
Design Patterns Lecture part 2.
Factory Patterns 1.
Presented by Igor Ivković
Ms Munawar Khatoon IV Year I Sem Computer Science Engineering
Design pattern Lecture 9.
Strategy Design Pattern
Design Patterns (Gamma, Helm, Johnson, Vlissides)
Presented by Igor Ivković
Presentation transcript:

ECE 355 Design Patterns Tutorial Part 2 (based on slides by Ali Razavi) Presented by Igor Ivković

2 Agenda  Design Patterns  Abstract Factory oSingleton oFaçade oObserver oStrategy oSummary and References

3 Abstract Factory /1  Intent: –Provide an interface for creating families of related or dependent objects without specifying their concrete classes  Applicability: –A system should be independent of how its products are created, composed and represented –A system should be configured with one of multiple families of products –A family of related product objects is designed to be together and this constraint needs to be enforced –A class library of products is to be developed so that only their interfaces and not their implementations are revealed

4 Abstract Factory /2

5 Abstract Factory /3

6 Abstract Factory /4

7 Abstract Factory /5

8 Abstract Factory /6

9 Agenda  Design Patterns Abstract Factory  Singleton oFaçade oObserver oStrategy oSummary and References

10 Singleton /1  Intent: –Ensure that a class only has one instance, and provide a global point of access to it  Applicability: –There must be exactly one instance of a class, and it must be accessible to clients from a well-known access point –When the sole instance should be extensible by subclassing, and clients should be able to use an extended instance without modifying their code

11 Singleton /2

12 Agenda  Design Patterns Abstract Factory Singleton  Façade oObserver oStrategy oSummary and References

13 Façade /1  Intent: –Provide a unified interface to a set of interfaces in a subsystem –Facade defines a higher-level interface that makes the subsystem easier to use  Applicability: –A simple interface for complex subsystems –There are many dependencies between clients and the implementation classes of an abstraction –You want to layer your subsystems

14 Façade /2

15 Façade /3

16 Façade /4

17 Agenda  Design Patterns Abstract Factory Singleton Façade  Observer oStrategy  Summary and References

18 Observer /1  In a system partitioned into classes, consistency between related objects must be maintained –To maintain their reusability, classes must not be tightly coupled  The observer pattern addresses dependency between objects without increasing the coupling between classes  Is useful when data must be presented in several different forms at one time –The objects that display the data are separate from the one that contains the data –The display objects observe changes in that data

19 Observer /2  Definition: “Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically”  Also known as: Publish-Subscribe, Dependents  This pattern can be used in any of the following situations: –A change in one object requires changing other objects, and the number of objects to be changed is not known –The objects not be tightly coupled, i.e. no assumptions should be made about the type of the objects being notified –Encapsulating dependent aspects of an abstraction in separate objects allows them to be reused independently Design Patterns - Gamma, et al, 1995

20 Observer /3

21 Observer /4  In the example on previous slide: –The Observer design pattern’s key objects are the subject and observer –The subject is in a one-to-many relationship with the observer –All observers are intimated when there is any type of state change in the subject –Observers use the state of the subject to synchronize their own state

22 Observer /5  Observer Pattern Structure is as follows:

23 Agenda  Design Patterns Abstract Factory Singleton Façade Observer  Strategy  Summary and References

24 Strategy /1  Definition: “Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it”  Also known as: Policy Design Patterns - Gamma, et al, 1995

25 Strategy /2  This pattern can be used in any of the following situations: –The only difference in related classes is their behavior –Different variants [class hierarchy] of an algorithm are needed –Clients should not know about the data being used by an algorithm –Instead of multiple conditional statements when a class defines many behaviors

26 Strategy /3  The structure of the Strategy pattern is as follows

27 Agenda Design Patterns Abstract Factory Singleton Façade Observer Strategy  Summary and References

28 Tutorial Summary  In this tutorial, we have presented the following design patterns: –Abstract Factory, Singleton, Façade, Observer, and Strategy  We have demonstrated intent, applicability conditions, and illustrative examples for each pattern  We have also discussed pointers for further study

29 References  E. Gamma, R. Helm, R. Johnson, H. Vlissides, Design Patterns, Addison-Wesley,  B. Bruegge and A. H. Dutoit, Object-Oriented Software Engineering, Prentice Hall, 2004.