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

Similar documents
Design Patterns #3. Reid Holmes. Material and some slide content from: - GoF Design Patterns Book - Head First Design Patterns

Design Patterns Reid Holmes

Design Patterns Reid Holmes

Design Patterns V Structural Design Patterns, 2

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

SDC Design patterns GoF

Ingegneria del Software Corso di Laurea in Informatica per il Management. Design Patterns part 1

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

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

Design Patterns. An introduction

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

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

Lecture 20: Design Patterns II

Introduction to Software Engineering: Object Design I Reuse & Patterns

Design Patterns B. Reid Holmes. Material and some slide content from: - Head First Design Patterns Book - GoF Design Patterns Book

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

Object-Oriented Oriented Programming

THOMAS LATOZA SWE 621 FALL 2018 DESIGN PATTERNS

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

Lecture 21: Design Patterns III

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

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

Design Pattern- Creational pattern 2015

Software Design Patterns. Background 1. Background 2. Jonathan I. Maletic, Ph.D.

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

An Introduction to Patterns

Creational Design Patterns

Object-Oriented Design

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

Applying Design Patterns to SCA Implementations

GoF Design Pattern Categories

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

UNIT I Introduction to Design Patterns

Trusted Components. Reuse, Contracts and Patterns. Prof. Dr. Bertrand Meyer Dr. Karine Arnout

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

Reuse at Design Level: Design Patterns

Summary of the course lectures

Facade and Adapter. Comp-303 : Programming Techniques Lecture 19. Alexandre Denault Computer Science McGill University Winter 2004

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

Tuesday, October 4. Announcements

Software Quality Management

Design Patterns. Hausi A. Müller University of Victoria. Software Architecture Course Spring 2000

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

Chapter 8, Design Patterns Visitor

CS/CE 2336 Computer Science II

A Reconnaissance on Design Patterns

Using Design Patterns in Java Application Development

Design Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1

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

Review Software Engineering October, 7, Adrian Iftene

Topics in Object-Oriented Design Patterns

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

INSTITUTE OF AERONAUTICAL ENGINEERING

Software Engineering Prof. Rushikesh K.Joshi IIT Bombay Lecture-15 Design Patterns

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

Object-oriented Software Design Patterns

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

1 Software Architecture

The Design Patterns Matrix From Analysis to Implementation

COSC 3351 Software Design. Design Patterns Structural Patterns (II) Edgar Gabriel. Spring Decorator

Software Engineering - I An Introduction to Software Construction Techniques for Industrial Strength Software

Design Patterns in Python (Part 2)

SYLLABUS CHAPTER - 1 [SOFTWARE REUSE SUCCESS FACTORS] Reuse Driven Software Engineering is a Business

CISC 322 Software Architecture

Application Architectures, Design Patterns

Brief Note on Design Pattern

CSE870: Advanced Software Engineering (Cheng) 1

Coordination Patterns

» Reader for RTF (Rich Text Format) should be able to convert to any other representation Plain Text, MIF (Maker Interchange File), Postscript

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

Design patterns. Jef De Smedt Beta VZW

OODP OOAD Session 7a

Design Patterns. SE3A04 Tutorial. Jason Jaskolka

LECTURE NOTES ON DESIGN PATTERNS MCA III YEAR, V SEMESTER (JNTUA-R09)

Lectures 24 and 25 Introduction to Architectural Styles and Design Patterns

Idioms and Design Patterns. Martin Skogevall IDE, Mälardalen University

Design Patterns. Observations. Electrical Engineering Patterns. Mechanical Engineering Patterns

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

MVC / MVP Mei Nagappan

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

Design Patterns! Acknowledgements!

Introduction and History

UNIT I Introduction to Design Patterns

UP Requirements. Software Design - Dr Eitan Hadar (c) Activities of greater emphasis in this book. UP Workflows. Business Modeling.

administrivia today UML start design patterns Tuesday, September 28, 2010

Design Patterns: Structural and Behavioural

Ingegneria del Software Corso di Laurea in Informatica per il Management. Design Patterns part 1

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

A few important patterns and their connections

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

The GoF Design Patterns Reference

Design Patterns IV Structural Design Patterns, 1

CHAPTER 6: CREATIONAL DESIGN PATTERNS

Design Patterns. Gunnar Gotshalks A4-1

CS251 Software Engineering Lectures 18: Intro to DP

CSSE 374: More Object Design with Gang of Four Design Patterns

Lecture 19: Introduction to Design Patterns

Design Patterns. Softwaretechnik. Matthias Keil. Albert-Ludwigs-Universität Freiburg

Lecture 17: Patterns Potpourri. Copyright W. Howden 1

Overview of Patterns: Introduction

Transcription:

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 #,3-".7$8&-5"9 :9,<-".$=$30,'' B*-&.<.&-&. D&><0,-&$8&-5"9 30,'' :;'-.,3-$#,3-".7 :9,<-".=";?&3- /5,(*$"C$.&'<"*'(;(0(-7 42(09&. 4.(9)& /">>,*9 +."-"-7<& /"><"'(-& B-&.,-". 1(*)0&-"* %&3".,-". 8&9(,-". 8&>&*-" E;'&.6&. #,3,9& #07@&()5- ";?&3- +."A7 1-,-& 1-.,-&)7 F('(-".

Singleton Intent: Ensure a class has only one instance Motivation:? Applicability: Situations when there must be only one copy of a class.

Singleton Structure: Participants: an instance operation that retrieves the instance. may be responsible for creating instance.

Singleton Collaborations All collaboration via instance operation. Consequences: Controlled access to instance. Reduced name space. Permits variable number of instances. More flexible than class operations.

Singleton Implementation: 1.? 2.? Related to: Can be used to create Abstract Factory, Builder, and Prototype.

Abstract factory Intent: Provide an interface for creating families of related objects without specifying their concrete classes Motivation: Consider a multi-platform UI toolkit. A WidgetFactory can provide an interface to make sure the right widget is instantiated for each platform. Applicability: When a system should be independent of how its products are created and represented. A system contains multiple families of products.?

Abstract factory Structure Participants: Abstract/Concrete Factory Abstract/Concrete Product Client

Abstract factory Collaborations Usually only one Abstract Factory (singleton). Objects are created by concrete factories. Consequences: Isolates concrete classes from clients.? Makes exchanging families easy.? Makes adding products hard.?

Abstract factory Implementation: Create abstract factory interface. Use factory method to create descriptive names. Create concrete products/factories.? Known uses: Frequently used in widget toolkits. Related to: Often implemented with Factory Method or Prototypes. Concrete factories are often Singletons.

Builder Intent: Separate the construction of complex objects from its representation. Motivation: Consider a text reader that must convert back and forth between RTF, ASCII, and TeX. The ordering / combinations are unbounded requiring a flexible composition mechanism. Applicability:? When the construction process must allow for different representation.

Builder Structure Participants: Builder / Concrete Builder Director Product

Builder Collaborations: Client creates director with desired builder. Director tells builder to build parts. Client retrieves parts from builder. Consequences: Vary internal representation. Isolates code from construction / representation.?

Builder Implementation: 1) Create flexible construction interface. Allow new parts to be appended to the existing whole. 2) Don t bother with abstract products, they usually vary enough that it doesn t help much. 3) Don t use interface for Builder; empty methods allow ConcreteBuilders to choose what methods to implement. Known uses: Smalltalk parser & ClassBuilder. Related to: Similar to Abstract Factory. Frequently builds Composite objects.

Builder Example REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Proxy Intent: Provide a placeholder to control access to another object. Motivation: One reason to control access is cost: consider an object that is expensive to populate entirely but cheap to partially populate. (e.g., remote object, large file from disk, etc.) Applicability: (When a more versatile reference is needed.) Remote:? Virtual:? Protection: Protect access to objects. Smart reference: Performs additional actions.

Proxy Structure Participants: Proxy Subject / RealSubject

Proxy Collaborations: Client interacts with proxy. Proxy forwards req. to RealSubject as required. Consequences: Remote:? Virtual:? Protection: Housekeeping / auth can occur.

Proxy Implementation: 1) Create common interface for Proxy/ RealSubject. 2) Reference Proxy in Client. 3) Proxy forwards requests as necessary. Known uses: Image manipulation / RPC. Related to: Similar to Adapter and Decorator. Decorators add responsibilities while proxies serve as mediators.

Proxy wrt Project REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Facade Intent: Provide a unified, higher-level, interface to a whole module making it easier to use. Motivation:? Applicability: When you want a simple interface to a complex subsystem.? You want to layer your subsystems.

Facade REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Facade Participants: Facade Subsystem classes Collaborations: Clients interact subsystem via Facade. Consequences:? Promotes? Doesn t prevent access to subsystem classes.

Facade Implementation: 1) Analyze client / subsystem tangling. 2) Create interface. Abstract factories can also be used to add further decoupling. Known uses: Varied. Related to: Abstract Factory can be used with Facade to create subsystem objects. Facades are frequently Singletons. Abstracts functionality similar to Mediator but does not concentrate on communication.

Facade wrt Project REID HOLMES - SE2: SOFTWARE DESIGN & ARCHITECTURE

Activity 5 mins: Right side: Develop a use for a facade pattern for your system. Left side: Develop a usage of a proxy pattern for your system. 10 mins (5 / group): Match up with team from other side of room. Explain your pattern and how it improves your system s design.