Factory Method. Comp435 Object-Oriented Design. Factory Method. Factory Method. Factory Method. Factory Method. Computer Science PSU HBG.

Size: px
Start display at page:

Download "Factory Method. Comp435 Object-Oriented Design. Factory Method. Factory Method. Factory Method. Factory Method. Computer Science PSU HBG."

Transcription

1 Comp435 Object-Oriented Design Week 11 Computer Science PSU HBG 1 Define an interface for creating an object Let subclasses decide which class to instantiate Defer instantiation to subclasses Avoid the creation of specific objects from framework High-level framework Application-specific objects to create is not known Use abstract classes» Define and maintain relationship between objects Application Application-specific subclasses of the abstract class» Override the factory method 2 Cannot anticipate the objects to be created Want to let subclasses to specify details of objects to be created Localize the creation of various objects Product Creator FactoryMethod() AnOperation() product = FactoryMethod() ConcreteProduct ConcreteCreator FactoryMethod() return new ConcreteProduct 3 4 Product / ConcreteProduct Creator / ConcreteCreator Creator relies on ConcreteCreator ConcreteCreator Override the factory method of Creator Returns an instance of ConcreteProduct Provide hooks for subclasses Flexibility on creating objects Connect parallel class hierarchies 5 6 1

2 Parallel Class Hierarchies Figure Manipulator LineFigure TextFigure LineManipulator TextManipulator 7 8 Without violating encapsulation, capture and externalize an object s internal state so that the object can be restored to this state later Want to store private state information of object Ex: support UNDO operation Want to avoid violating encapsulation Object s internal state should be available Object s internal state should not be visible to other objects Solution Use an object that stores snapshot of another object 9 A snapshot of whole/part of an object s state must be saved A direct interface to obtaining the state may expose internal implementation 10 Originator Set( m) Create() state return new (state) GetState() SetState() state state = m GetState() memento Caretaker 11, Originator, Caretaker Caretaker Requests a memento from an originator Holds it for a time Passes it back to the originator Originator Creates a memento upon Caretaker s request Sets the memento s state with its current state Retrieves the memento s state to restore its state Passive object 12 2

3 Preserves encapsulation boundaries Simplifies Originator May be expensive Hidden cost to Caretaker Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype Want to reduce number of classes Ex: Building car engines Have common structures (material, shape, etc) Some attributes are different (4 valves vs 6 valves, etc)» Use inheritance: leads to class cluttering 15 Classes to instantiate are specified at run time Want to avoid parallel class hierarchy of factories Instances of a class can have one of only a few different combinations of state 16 Operation() p=prototype Concrete1 Concrete2 / Concrete asks a prototype to clone itself return copy of self return copy of self

4 Adding / removing products at run-time Specifying new objects by varying values Specifying new objects by varying structures Reduced subclassing Shallow copying Default copy constructor Deep copying Define your own copy constructor Provide a surrogate or placeholder for another object to control access to it Need a more versatile or sophisticated reference than a simple pointer Control access to the actual objects by authentication Cache results from actual object for faster access Lazy initialization of expensive objects 21 Remote proxy Local representative for an object in a different address space Virtual proxy Lazy creation of expensive objects on demand Protection proxy Controlled access to the original object for protection Smart reference Additional actions when an object is accessed 22 RealSubject realsubject Subject realsubject Subject / RealSubject forward requests to RealSubject when appropriate

5 Introduces a level of indirection Remote proxy Disguise remote objects as local objects Virtual proxy Perform optimization such as lazy creation Protection proxy / smart reference Allow additional housekeeping when object is accessed

Factory Method Pattern Creational. » Define an interface for creating an object but lets subclasses decide the specific class to instantiate

Factory Method Pattern Creational. » Define an interface for creating an object but lets subclasses decide the specific class to instantiate Factory Method Pattern Creational Intent» Define an interface for creating an object but lets subclasses decide the specific class to instantiate > Delegate creation to the appropriate subclass Also known

More information

Object-Oriented Oriented Programming Factory Method Pattern Abstract Factory Pattern. CSIE Department, NTUT Woei-Kae Chen

Object-Oriented Oriented Programming Factory Method Pattern Abstract Factory Pattern. CSIE Department, NTUT Woei-Kae Chen Object-Oriented Oriented Programming Factory Method Pattern Abstract Factory Pattern CSIE Department, NTUT Woei-Kae Chen Factory Method Pattern Factory Method Pattern Creational pattern Factory Method:

More information

Brief Note on Design Pattern

Brief Note on Design Pattern Brief Note on Design Pattern - By - Channu Kambalyal channuk@yahoo.com This note is based on the well-known book Design Patterns Elements of Reusable Object-Oriented Software by Erich Gamma et., al.,.

More information

EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 6: Design Patterns

EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 6: Design Patterns EPL 603 TOPICS IN SOFTWARE ENGINEERING Lab 6: Design Patterns Links to Design Pattern Material 1 http://www.oodesign.com/ http://www.vincehuston.org/dp/patterns_quiz.html Types of Design Patterns 2 Creational

More information

Tecniche di Progettazione: Design Patterns

Tecniche di Progettazione: Design Patterns Tecniche di Progettazione: Design Patterns GoF: Memento Prototype Visitor 1 Design patterns, Laura Semini, Università di Pisa, Dipartimento di Informatica. Memento 2 Design patterns, Laura Semini, Università

More information

Laboratorio di Progettazione di Sistemi Software Design Pattern Creazionali. Valentina Presutti (A-L) Riccardo Solmi (M-Z)

Laboratorio di Progettazione di Sistemi Software Design Pattern Creazionali. Valentina Presutti (A-L) Riccardo Solmi (M-Z) Laboratorio di Progettazione di Sistemi Software Design Pattern Creazionali Valentina Presutti (A-L) Riccardo Solmi (M-Z) Indice degli argomenti Catalogo di Design Patterns creazionali: Abstract Factory

More information

Introduction to Software Engineering: Object Design I Reuse & Patterns

Introduction to Software Engineering: Object Design I Reuse & Patterns Introduction to Software Engineering: Object Design I Reuse & Patterns John T. Bell Department of Computer Science University of Illinois, Chicago Based on materials from Bruegge & DuToit 3e, Chapter 8,

More information

Design Pattern. CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.)

Design Pattern. CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.) Design Pattern CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.) A. Design Pattern Design patterns represent the best practices used by experienced

More information

Tecniche di Progettazione: Design Patterns

Tecniche di Progettazione: Design Patterns Tecniche di Progettazione: Design Patterns GoF: Mediator Memento Prototype 1 Design patterns, Laura Semini, Università di Pisa, Dipartimento di Informatica. Mediator 2 Design patterns, Laura Semini, Università

More information

Software Design COSC 4353/6353 D R. R A J S I N G H

Software Design COSC 4353/6353 D R. R A J S I N G H Software Design COSC 4353/6353 D R. R A J S I N G H Creational Design Patterns What are creational design patterns? Types Examples Structure Effects Creational Patterns Design patterns that deal with object

More information

Goals of Lecture. Lecture 27: OO Design Patterns. Pattern Resources. Design Patterns. Cover OO Design Patterns. Pattern Languages of Programming

Goals of Lecture. Lecture 27: OO Design Patterns. Pattern Resources. Design Patterns. Cover OO Design Patterns. Pattern Languages of Programming Goals of Lecture Lecture 27: OO Design Patterns Cover OO Design Patterns Background Examples Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2001 April 24, 2001 Kenneth

More information

SDC Design patterns GoF

SDC Design patterns GoF SDC Design patterns GoF Design Patterns The design pattern concept can be viewed as an abstraction of imitating useful parts of other software products. The design pattern is a description of communicating

More information

Design Patterns. Manuel Mastrofini. Systems Engineering and Web Services. University of Rome Tor Vergata June 2011

Design Patterns. Manuel Mastrofini. Systems Engineering and Web Services. University of Rome Tor Vergata June 2011 Design Patterns Lecture 1 Manuel Mastrofini Systems Engineering and Web Services University of Rome Tor Vergata June 2011 Definition A pattern is a reusable solution to a commonly occurring problem within

More information

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico Modellistica Medica Maria Grazia Pia INFN Genova Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico 2002-2003 Lezione 8 OO modeling Design Patterns Introduction Creational Patterns Software

More information

Design of Software Systems (Ontwerp van SoftwareSystemen) Design Patterns Reference. Roel Wuyts

Design of Software Systems (Ontwerp van SoftwareSystemen) Design Patterns Reference. Roel Wuyts Design of Software Systems (Ontwerp van SoftwareSystemen) Design Patterns Reference 2015-2016 Visitor See lecture on design patterns Design of Software Systems 2 Composite See lecture on design patterns

More information

The Strategy Pattern Design Principle: Design Principle: Design Principle:

The Strategy Pattern Design Principle: Design Principle: Design Principle: Strategy Pattern The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it. Design

More information

DESIGN PATTERNS FOR MERE MORTALS

DESIGN PATTERNS FOR MERE MORTALS DESIGN PATTERNS FOR MERE MORTALS Philip Japikse (@skimedic) skimedic@outlook.com www.skimedic.com/blog Microsoft MVP, ASPInsider, MCSD, MCDBA, CSM, CSP Consultant, Teacher, Writer Phil.About() Consultant,

More information

Design Pattern- Creational pattern 2015

Design Pattern- Creational pattern 2015 Creational Patterns Abstracts instantiation process Makes system independent of how its objects are created composed represented Encapsulates knowledge about which concrete classes the system uses Hides

More information

What is Design Patterns?

What is Design Patterns? Paweł Zajączkowski What is Design Patterns? 1. Design patterns may be said as a set of probable solutions for a particular problem which is tested to work best in certain situations. 2. In other words,

More information

Prototype Description. Interpreter. interpreter Calculator Design Rationales. Prototype Participants. Interpreter with Factory Method.

Prototype Description. Interpreter. interpreter Calculator Design Rationales. Prototype Participants. Interpreter with Factory Method. Onno van Roosmalen Pieter van den Hombergh Fontys Hogeschool voor Techniek en Logistiek October 3, 2014 Content Implementation Description with Factory Participants Implementation Description with Factory

More information

Appendix-A. A.1 Catalogues of Design Patterns. Below is the definition for each design pattern using the FINDER notation, followed

Appendix-A. A.1 Catalogues of Design Patterns. Below is the definition for each design pattern using the FINDER notation, followed A Appendix-A A.1 Catalogues of Design Patterns Below is the definition for each design pattern using the FINDER notation, followed by a description of the rules. These definitions have been created using

More information

Lecture 13: Design Patterns

Lecture 13: Design Patterns 1 Lecture 13: Design Patterns Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2005 2 Pattern Resources Pattern Languages of Programming Technical conference on Patterns

More information

Dr. Xiaolin Hu. Review of last class

Dr. Xiaolin Hu. Review of last class Review of last class Design patterns Creational Structural Behavioral Abstract Factory Builder Factory Singleton etc. Adapter Bridge Composite Decorator Façade Proxy etc. Command Iterator Observer Strategy

More information

Factory Method Pattern Tutorial Written Date : September 28, 2009

Factory Method Pattern Tutorial Written Date : September 28, 2009 Written Date : September 28, 2009 This tutorial is aimed to guide the definition and application of Gang of Four (GoF) factory design pattern. By reading this tutorial, you will know how to develop a model

More information

Lecture 21: Design Patterns III

Lecture 21: Design Patterns III Lecture 21: Design Patterns III Software System Design and Implementation ITCS/ITIS 6112/8112 001 Fall 2008 Dr. Jamie Payton Department of Computer Science University of North Carolina at Charlotte Nov.

More information

Pattern Resources. Lecture 25: Design Patterns. What are Patterns? Design Patterns. Pattern Languages of Programming. The Portland Pattern Repository

Pattern Resources. Lecture 25: Design Patterns. What are Patterns? Design Patterns. Pattern Languages of Programming. The Portland Pattern Repository Pattern Resources Lecture 25: Design Patterns Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2003 Pattern Languages of Programming Technical conference on Patterns

More information

4.1 Introduction Programming preliminaries Constructors Destructors An example... 3

4.1 Introduction Programming preliminaries Constructors Destructors An example... 3 Department of Computer Science Tackling Design Patterns Chapter 4: Factory Method design pattern Copyright c 2016 by Linda Marshall and Vreda Pieterse. All rights reserved. Contents 4.1 Introduction.................................

More information

Produced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar

Produced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar Design Patterns MSc in Communications Software Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie

More information

Object-oriented Software Design Patterns

Object-oriented Software Design Patterns Object-oriented Software Design Patterns Concepts and Examples Marcelo Vinícius Cysneiros Aragão marcelovca90@inatel.br Topics What are design patterns? Benefits of using design patterns Categories and

More information

Creational Patterns. Factory Method (FM) Abstract Factory (AF) Singleton (SI) Prototype (PR) Builder (BU)

Creational Patterns. Factory Method (FM) Abstract Factory (AF) Singleton (SI) Prototype (PR) Builder (BU) Creational Patterns Creational Patterns Factory Method (FM) Abstract Factory (AF) Singleton (SI) Prototype (PR) Builder (BU) Factory Method (FM) Intent: Define an interface for creating an object, but

More information

CSE870: Advanced Software Engineering (Cheng) 1

CSE870: Advanced Software Engineering (Cheng) 1 Design Patterns Acknowledgements Materials based on a number of sources D. Levine and D. Schmidt. Helm Gamma et al S. Konrad Motivation Developing software is hard Designing reusable software is more challenging

More information

OODP Session 5a. Web Page: Visiting Hours: Tuesday 17:00 to 19:00

OODP Session 5a.   Web Page:  Visiting Hours: Tuesday 17:00 to 19:00 OODP Session 5a Next week: Reading week Session times PT group 1 Monday 18:00 21:00 room: Malet 403 PT group 2 Thursday 18:00 21:00 room: Malet 407 FT Tuesday 13:30 17:00 room: Malet 404 Email: oded@dcs.bbk.ac.uk

More information

Design Patterns. Manuel Mastrofini. Systems Engineering and Web Services. University of Rome Tor Vergata June 2011

Design Patterns. Manuel Mastrofini. Systems Engineering and Web Services. University of Rome Tor Vergata June 2011 Design Patterns Lecture 2 Manuel Mastrofini Systems Engineering and Web Services University of Rome Tor Vergata June 2011 Structural patterns Part 2 Decorator Intent: It attaches additional responsibilities

More information

Object-Oriented Design

Object-Oriented Design Object-Oriented Design Lecturer: Raman Ramsin Lecture 20: GoF Design Patterns Creational 1 Software Patterns Software Patterns support reuse of software architecture and design. Patterns capture the static

More information

Lecture 17: Patterns Potpourri. Copyright W. Howden 1

Lecture 17: Patterns Potpourri. Copyright W. Howden 1 Lecture 17: Patterns Potpourri Copyright W. Howden 1 GOF Patterns GOF: Gamma, Helm, Johnson, Vlissides Design Patterns, Addison Wesley, 1995 Patterns we have seen so far Creational Patterns e.g. Factory,

More information

Reuse at Design Level: Design Patterns

Reuse at Design Level: Design Patterns Reuse at Design Level: Design Patterns CS 617- Lecture 17 Mon. 17 March 2008 3:30-5:00 pm Rushikesh K. Joshi Department of Computer Sc. & Engg. Indian Institute of Technology, Bombay Mumbai - 400 076 Reuse

More information

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico Modellistica Medica Maria Grazia Pia INFN Genova Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico 2002-2003 Lezione 9 OO modeling Design Patterns Structural Patterns Behavioural Patterns

More information

Object-Oriented Oriented Programming

Object-Oriented Oriented Programming Object-Oriented Oriented Programming Composite Pattern CSIE Department, NTUT Woei-Kae Chen Catalog of Design patterns Creational patterns Abstract Factory, Builder, Factory Method, Prototype, Singleton

More information

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich CSCD01 Engineering Large Software Systems Design Patterns Joe Bettridge Winter 2018 With thanks to Anya Tafliovich Design Patterns Design patterns take the problems consistently found in software, and

More information

Design Patterns. GoF design patterns catalog

Design Patterns. GoF design patterns catalog Design Patterns GoF design patterns catalog OMT notations - classes OMT notation - relationships Inheritance - triangle Aggregation - diamond Acquaintance keeps a reference solid line with arrow Creates

More information

C++ Inheritance and Encapsulation

C++ Inheritance and Encapsulation C++ Inheritance and Encapsulation Private and Protected members Inheritance Type Public Inheritance Private Inheritance Protected Inheritance Special method inheritance 1 Private Members Private members

More information

SOLID DESIGN PATTERNS FOR MERE MORTALS

SOLID DESIGN PATTERNS FOR MERE MORTALS SOLID DESIGN PATTERNS FOR MERE MORTALS Philip Japikse (@skimedic) skimedic@outlook.com www.skimedic.com/blog Microsoft MVP, ASPInsider, MCSD, MCDBA, CSM, PSM, PSD Consultant, Teacher, Writer Phil.About()

More information

Software Design COSC 4353/6353 D R. R A J S I N G H

Software Design COSC 4353/6353 D R. R A J S I N G H Software Design COSC 4353/6353 D R. R A J S I N G H Design Patterns What are design patterns? Why design patterns? Example DP Types Toolkit, Framework, and Design Pattern A toolkit is a library of reusable

More information

Design patterns. Jef De Smedt Beta VZW

Design patterns. Jef De Smedt Beta VZW Design patterns Jef De Smedt Beta VZW Who Beta VZW www.betavzw.org Association founded in 1993 Computer training for the unemployed Computer training for employees (Cevora/Cefora) 9:00-12:30 13:00-16:00

More information

CS 2720 Practical Software Development University of Lethbridge. Design Patterns

CS 2720 Practical Software Development University of Lethbridge. Design Patterns Design Patterns A design pattern is a general solution to a particular class of problems, that can be reused. They are applicable not just to design. You can think of patterns as another level of abstraction.

More information

Design patterns. OOD Lecture 6

Design patterns. OOD Lecture 6 Design patterns OOD Lecture 6 Next lecture Monday, Oct 1, at 1:15 pm, in 1311 Remember that the poster sessions are in two days Thursday, Sep 27 1:15 or 3:15 pm (check which with your TA) Room 2244 + 2245

More information

Microsoft Visual Basic 2005: Reloaded

Microsoft Visual Basic 2005: Reloaded Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 10 Creating Classes and Objects Objectives After studying this chapter, you should be able to: Define a class Instantiate an object from a class

More information

Socket attaches to a Ratchet. 2) Bridge Decouple an abstraction from its implementation so that the two can vary independently.

Socket attaches to a Ratchet. 2) Bridge Decouple an abstraction from its implementation so that the two can vary independently. Gang of Four Software Design Patterns with examples STRUCTURAL 1) Adapter Convert the interface of a class into another interface clients expect. It lets the classes work together that couldn't otherwise

More information

Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later.

Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later. Memento 1 Intent Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later. Also Known As Token Motivation A graphical editor

More information

Keywords: Abstract Factory, Singleton, Factory Method, Prototype, Builder, Composite, Flyweight, Decorator.

Keywords: Abstract Factory, Singleton, Factory Method, Prototype, Builder, Composite, Flyweight, Decorator. Comparative Study In Utilization Of Creational And Structural Design Patterns In Solving Design Problems K.Wseem Abrar M.Tech., Student, Dept. of CSE, Amina Institute of Technology, Shamirpet, Hyderabad

More information

DESIGN PATTERN - INTERVIEW QUESTIONS

DESIGN PATTERN - INTERVIEW QUESTIONS DESIGN PATTERN - INTERVIEW QUESTIONS http://www.tutorialspoint.com/design_pattern/design_pattern_interview_questions.htm Copyright tutorialspoint.com Dear readers, these Design Pattern Interview Questions

More information

GoF Design Pattern Categories

GoF Design Pattern Categories GoF Design Pattern Categories Purpose Creational Structural Behavioral Scope Class Factory Method Adapter Interpreter Template Method Object Abstract Factory Builder Prototype Singleton Adapter Bridge

More information

Object Oriented Paradigm

Object Oriented Paradigm Object Oriented Paradigm Ming-Hwa Wang, Ph.D. Department of Computer Engineering Santa Clara University Object Oriented Paradigm/Programming (OOP) similar to Lego, which kids build new toys from assembling

More information

Design Patterns. SE3A04 Tutorial. Jason Jaskolka

Design Patterns. SE3A04 Tutorial. Jason Jaskolka SE3A04 Tutorial Jason Jaskolka Department of Computing and Software Faculty of Engineering McMaster University Hamilton, Ontario, Canada jaskolj@mcmaster.ca November 18/19, 2014 Jason Jaskolka 1 / 35 1

More information

Design Patterns. (and anti-patterns)

Design Patterns. (and anti-patterns) Design Patterns (and anti-patterns) Design Patterns The Gang of Four defined the most common object-oriented patterns used in software. These are only the named ones Lots more variations exist Design Patterns

More information

What is Design Patterns?

What is Design Patterns? Paweł Zajączkowski What is Design Patterns? 1. Design patterns may be said as a set of probable solutions for a particular problem which is tested to work best in certain situations. 2. In other words,

More information

Design Patterns. CSE870: Advanced Software Engineering (Design Patterns): Cheng

Design Patterns. CSE870: Advanced Software Engineering (Design Patterns): Cheng Design Patterns Acknowledgements Materials based on a number of sources D. Levine and D. Schmidt. Helm Gamma et al S. Konrad Motivation Developing software is hard Designing reusable software is more challenging

More information

Design Patterns! Acknowledgements!

Design Patterns! Acknowledgements! Design Patterns! Acknowledgements! Materials based on a number of sources! D. Levine and D. Schmidt!. Helm! Gamma et al! S. Konrad! (Cheng) 1 Motivation! Developing software is hard! Designing reusable

More information

Design Patterns Reid Holmes

Design Patterns Reid Holmes Material and some slide content from: - Head First Design Patterns Book - GoF Design Patterns Book Design Patterns Reid Holmes GoF design patterns $ %!!!! $ "! # & Pattern vocabulary Shared vocabulary

More information

26.1 Introduction Programming Preliminaries... 2

26.1 Introduction Programming Preliminaries... 2 Department of Computer Science Tackling Design Patterns Chapter 27: Proxy Design Pattern Copyright c 2016 by Linda Marshall and Vreda Pieterse. All rights reserved. Contents 26.1 Introduction.................................

More information

Object Oriented. Analysis and Design

Object Oriented. Analysis and Design OODP- OOAD Session 5 Object Oriented Analysis and Design Oded Lachish Department of Computer Science and Information Systems Birkbeck College, University of London Email: oded@dcs.bbk.ac.uk Web Page: http://www.dcs.bbk.ac.uk/~oded

More information

Design Patterns. Dr. Rania Khairy. Software Engineering and Development Tool

Design Patterns. Dr. Rania Khairy. Software Engineering and Development Tool Design Patterns What are Design Patterns? What are Design Patterns? Why Patterns? Canonical Cataloging Other Design Patterns Books: Freeman, Eric and Elisabeth Freeman with Kathy Sierra and Bert Bates.

More information

Chair of Software Engineering. Languages in Depth Series: Java Programming. Prof. Dr. Bertrand Meyer. Exercise Session 10

Chair of Software Engineering. Languages in Depth Series: Java Programming. Prof. Dr. Bertrand Meyer. Exercise Session 10 Chair of Software Engineering Languages in Depth Series: Java Programming Prof. Dr. Bertrand Meyer Exercise Session 10 Today s Exercise Session Pattern of the Day Proxy Quizzes 2 Proxy Pattern Structural

More information

What is Design Patterns?

What is Design Patterns? Paweł Zajączkowski What is Design Patterns? 1. Design patterns may be said as a set of probable solutions for a particular problem which is tested to work best in certain situations. 2. In other words,

More information

If we aren t supposed to program to an implementation then how can we actually create new things? Reptile reptile = new Turtle(); Software Engineering

If we aren t supposed to program to an implementation then how can we actually create new things? Reptile reptile = new Turtle(); Software Engineering CSC40232: SOFTWARE ENGINEERING Professor: Jane Cleland Huang Lecture 3: Observer Pattern Wednesday, January 18 th sarec.nd.edu/courses/se2017 Department of Computer Science and Engineering If we aren t

More information

Design Pattern and Software Architecture: IV. Design Pattern

Design Pattern and Software Architecture: IV. Design Pattern Design Pattern and Software Architecture: IV. Design Pattern AG Softwaretechnik Raum E 3.165 Tele.. 60-3321 hg@upb.de IV. Design Pattern IV.1 Introduction IV.2 Example: WYSIWYG Editor Lexi IV.3 Creational

More information

Final Exam Review (extended)

Final Exam Review (extended) Final Exam Review (extended) 15-413: Introduction to Software Engineering Jonathan Aldrich Hoare Logic { N > 0, M > 0 } p := 1 i := N while (i > 0) p := p * M; i := i - 1; { p = M N } Loop invariant? p=m^(n-i)

More information

Egon Borger (Pisa) Capturing Design Pattern Abstractions by ASMs

Egon Borger (Pisa) Capturing Design Pattern Abstractions by ASMs Egon Borger (Pisa) Capturing Design Pattern Abstractions by ASMs Universita di Pisa, Dipartimento di Informatica, I-56127 Pisa, Italy boerger@di.unipi.it visiting SAP Research, Karlsruhe, Germany egon.boerger@sap.com

More information

Design for change. You should avoid

Design for change. You should avoid Design patterns Sources Cours de Pascal Molli «A System of Pattern» Bushmann et All «Design Patterns» Gamma et All (GoF) «Applying UML and Patterns» Larman "Design Patterns Java Workbook" Steven John Metsker

More information

Software Reengineering Refactoring To Patterns. Martin Pinzger Delft University of Technology

Software Reengineering Refactoring To Patterns. Martin Pinzger Delft University of Technology Software Reengineering Refactoring To Patterns Martin Pinzger Delft University of Technology Outline Introduction Design Patterns Refactoring to Patterns Conclusions 2 The Reengineering Life-Cycle (1)

More information

Using Design Patterns in Java Application Development

Using Design Patterns in Java Application Development Using Design Patterns in Java Application Development ExxonMobil Research & Engineering Co. Clinton, New Jersey Michael P. Redlich (908) 730-3416 michael.p.redlich@exxonmobil.com About Myself Degree B.S.

More information

CHAPTER 6: CREATIONAL DESIGN PATTERNS

CHAPTER 6: CREATIONAL DESIGN PATTERNS CHAPTER 6: CREATIONAL DESIGN PATTERNS SESSION III: BUILDER, PROTOTYPE, SINGLETON Software Engineering Design: Theory and Practice by Carlos E. Otero Slides copyright 2012 by Carlos E. Otero For non-profit

More information

Cloning Enums. Cloning and Enums BIU OOP

Cloning Enums. Cloning and Enums BIU OOP Table of contents 1 Cloning 2 Integer representation Object representation Java Enum Cloning Objective We have an object and we need to make a copy of it. We need to choose if we want a shallow copy or

More information

Material and some slide content from: - GoF Design Patterns Book. Design Patterns #1. Reid Holmes. Lecture 11 - Tuesday October

Material and some slide content from: - GoF Design Patterns Book. Design Patterns #1. Reid Holmes. Lecture 11 - Tuesday October Material and some slide content from: - GoF Design Patterns Book Design Patterns #1 Reid Holmes Lecture 11 - Tuesday October 19 2010. GoF design patterns!"#$%&'()*$+,--&.*' /.&,-("*,0 1-.23-2.,0 4&5,6(".,0

More information

Component ConcreateComponent Decorator ConcreateDecoratorA ConcreteDecoratorB

Component ConcreateComponent Decorator ConcreateDecoratorA ConcreteDecoratorB Comp435 Object-Oriented Design Week 12 Computer Science PSU HBG Attach additional responsibilities to an object dynamically Provide a flexible alternative to subclassing for extending functionality Attach

More information

Development and Implementation of Workshop Management System Application to Explore Combing Multiple Design Patterns

Development and Implementation of Workshop Management System Application to Explore Combing Multiple Design Patterns St. Cloud State University therepository at St. Cloud State Culminating Projects in Computer Science and Information Technology Department of Computer Science and Information Technology 5-2015 Development

More information

be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate

be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate UNIT 4 GRASP GRASP: Designing objects with responsibilities Creator Information expert Low Coupling Controller High Cohesion Designing for visibility - Applying GoF design patterns adapter, singleton,

More information

Second Midterm Review

Second Midterm Review Second Midterm Review Comp-303 : Programming Techniques Lecture 24 Alexandre Denault Computer Science McGill University Winter 2004 April 5, 2004 Lecture 24 Comp 303 : Second Midterm Review Page 1 Announcements

More information

Adapter pattern. Acknowledgement: Freeman & Freeman

Adapter pattern. Acknowledgement: Freeman & Freeman Adapter pattern Acknowledgement: Freeman & Freeman Example Scenario The European wall outlet exposes one interface for getting power The adapter converts one interface into another The US laptop expects

More information

Programming II (CS300)

Programming II (CS300) 1 Programming II (CS300) Chapter 05: Inheritance and Interfaces MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Inheritance and Interfaces 2 Introduction Inheritance and Class Hierarchy Polymorphism Abstract

More information

COSC 3351 Software Design. Design Patterns Behavioral Patterns (II)

COSC 3351 Software Design. Design Patterns Behavioral Patterns (II) COSC 3351 Software Design Design Patterns Behavioral Patterns (II) Spring 2008 Purpose Creational Structural Behavioral Scope Class Factory Method Adapter(class) Interpreter Template Method Object Abstract

More information

Slide 1. Design Patterns. Prof. Mirco Tribastone, Ph.D

Slide 1. Design Patterns. Prof. Mirco Tribastone, Ph.D Slide 1 Design Patterns Prof. Mirco Tribastone, Ph.D. 22.11.2011 Introduction Slide 2 Basic Idea The same (well-established) schema can be reused as a solution to similar problems. Muster Abstraktion Anwendung

More information

(Factory Method) (Intent) (Motivation) (instantiate) (defer) f. (application) (application) ƒ (document) ¾ (application-specific)

(Factory Method) (Intent) (Motivation) (instantiate) (defer) f. (application) (application) ƒ (document) ¾ (application-specific) (Factory Method) (Intent) (instantiate)(defer) f y (Motivation) (Framework) g Ä k (application) ƒ (document) (application) (document) g (abstract) (clients) l ¾ (application-specific) f ¼ ¼ (DrawingApplication)

More information

Programming II (CS300)

Programming II (CS300) 1 Programming II (CS300) Chapter 05: Inheritance and Interfaces MOUNA KACEM mouna@cs.wisc.edu Fall 2018 Inheritance and Interfaces 2 Introduction Inheritance and Class Hierarchy Polymorphism Abstract Classes

More information

CSCI 253. Overview. The Elements of a Design Pattern. George Blankenship 1. Object Oriented Design: Creational Patterns. George Blankenship

CSCI 253. Overview. The Elements of a Design Pattern. George Blankenship 1. Object Oriented Design: Creational Patterns. George Blankenship CSCI 253 Object Oriented Design: George Blankenship George Blankenship 1 Singleton Abstract factory Factory Method Prototype Builder Overview Structural Patterns Composite Façade Proxy Flyweight Adapter

More information

THOMAS LATOZA SWE 621 FALL 2018 DESIGN PATTERNS

THOMAS LATOZA SWE 621 FALL 2018 DESIGN PATTERNS THOMAS LATOZA SWE 621 FALL 2018 DESIGN PATTERNS LOGISTICS HW3 due today HW4 due in two weeks 2 IN CLASS EXERCISE What's a software design problem you've solved from an idea you learned from someone else?

More information

CSC207H: Software Design Lecture 6

CSC207H: Software Design Lecture 6 CSC207H: Software Design Lecture 6 Wael Aboelsaadat wael@cs.toronto.edu http://ccnet.utoronto.ca/20075/csc207h1y/ Office: BA 4261 Office hours: R 5-7 Acknowledgement: These slides are based on material

More information

Design Patterns. Structural Patterns. Oliver Haase

Design Patterns. Structural Patterns. Oliver Haase Design Patterns Structural Patterns Oliver Haase 1 Purpose Structural patterns describe how to compose classes (incl. interfaces) and objects to get larger structures. Class based structural patterns use

More information

Lecture 5: Inheritance

Lecture 5: Inheritance McGill University Computer Science Department COMP 322 : Introduction to C++ Winter 2009 Lecture 5: Inheritance Sami Zhioua March 11 th, 2009 1 Inheritance Inheritance is a form of software reusability

More information

Abstract Class & Interface: Two Villains of Every Interview - Part 1

Abstract Class & Interface: Two Villains of Every Interview - Part 1 Abstract Class & Interface: Two Villains of Every Interview - Part 1 Every time I read about a Technical Interview, one question is always out there. What is the difference between an Abstract Class and

More information

ECE 449 OOP and Computer Simulation Lecture 11 Design Patterns

ECE 449 OOP and Computer Simulation Lecture 11 Design Patterns ECE 449 Object-Oriented Programming and Computer Simulation, Fall 2017, Dept. of ECE, IIT 1/60 ECE 449 OOP and Computer Simulation Lecture 11 Design Patterns Professor Jia Wang Department of Electrical

More information

The Proxy Pattern. Design Patterns In Java Bob Tarr

The Proxy Pattern. Design Patterns In Java Bob Tarr The Proxy Pattern Intent Provide a surrogate or placeholder for another object to control access to it Also Known As Surrogate Motivation A proxy is a person authorized to act for another person an agent

More information

I, J. Key-value observing (KVO), Label component, 32 text property, 39

I, J. Key-value observing (KVO), Label component, 32 text property, 39 Index A Abstract factory pattern, 207 concrete factory, 213 examples in Cocoa, 227 groups of objects, 212 implementing, 213 abstract factories, 214 concrete factories, 214 215 operations, 212 213 pitfalls,

More information

Proxy Design Pattern

Proxy Design Pattern Department of Computer Science University of Pretoria 27 & 28 October 2014 Name and Classification: Proxy (Object Structural) Intent: Provide a surrogate or placeholder for another object to control access

More information

A few important patterns and their connections

A few important patterns and their connections A few important patterns and their connections Perdita Stevens School of Informatics University of Edinburgh Plan Singleton Factory method Facade and how they are connected. You should understand how to

More information

Plan. A few important patterns and their connections. Singleton. Singleton: class diagram. Singleton Factory method Facade

Plan. A few important patterns and their connections. Singleton. Singleton: class diagram. Singleton Factory method Facade Plan A few important patterns and their connections Perdita Stevens School of Informatics University of Edinburgh Singleton Factory method Facade and how they are connected. You should understand how to

More information

Design Patterns. Comp2110 Software Design. Department of Computer Science Australian National University. Second Semester

Design Patterns. Comp2110 Software Design. Department of Computer Science Australian National University. Second Semester Design Patterns Comp2110 Software Design Department of Computer Science Australian National University Second Semester 2005 1 Design Pattern Space Creational patterns Deal with initializing and configuring

More information

Design Patterns Reid Holmes

Design Patterns Reid Holmes Material and some slide content from: - Head First Design Patterns Book - GoF Design Patterns Book Design Patterns Reid Holmes GoF design patterns $ %!!!! $ "! # & Pattern vocabulary Shared vocabulary

More information

Pro Objective-C Design Patterns for ios

Pro Objective-C Design Patterns for ios Pro Objective-C Design Patterns for ios Carlo Chung Contents Contents at a Glance About the Author About the Technical Reviewer Acknowledgments Preface x xi xii xiii Part I: Getting Your Feet Wet 1 Chapter

More information

Template Method. Kenneth M. Anderson University of Colorado, Boulder CSCI 4448/6448 Lecture 24 11/15/2007. University of Colorado, 2007

Template Method. Kenneth M. Anderson University of Colorado, Boulder CSCI 4448/6448 Lecture 24 11/15/2007. University of Colorado, 2007 Template Method Kenneth M. Anderson University of Colorado, Boulder CSCI 4448/6448 Lecture 24 11/15/2007 University of Colorado, 2007 1 Lecture Goals Cover Material from Chapter 8 of the Design Patterns

More information