Design Patterns: Structural and Behavioural

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

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

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

SDC Design patterns GoF

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

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

UNIT I Introduction to Design Patterns

UNIT I Introduction to Design Patterns

Design patterns. Jef De Smedt Beta VZW

Object-oriented Software Design Patterns

Object-Oriented Oriented Programming

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

Applying Design Patterns to SCA Implementations

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

Using Design Patterns in Java Application Development

A Reconnaissance on Design Patterns

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

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

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

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

Brief Note on Design Pattern

Object Oriented Paradigm

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

Software Eningeering. Lecture 9 Design Patterns 2

Design Patterns Lecture 2

Introduction to Software Engineering: Object Design I Reuse & Patterns

DESIGN PATTERN - INTERVIEW QUESTIONS

CSCI Object Oriented Design: Frameworks and Design Patterns George Blankenship. Frameworks and Design George Blankenship 1

INSTITUTE OF AERONAUTICAL ENGINEERING

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

Design Patterns. (and anti-patterns)

Object Oriented Methods with UML. Introduction to Design Patterns- Lecture 8

Design Patterns. SE3A04 Tutorial. Jason Jaskolka

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

Applying the Observer Design Pattern

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

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

design patterns FOR B.tech (jntu - hyderabad & kakinada) (IV/I - CSE AND IV/II - IT) CONTENTS 1.1 INTRODUCTION TO DESIGN PATTERNS TTERNS... TTERN?...

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

Design Patterns. An introduction

A few important patterns and their connections

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

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

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

1 Software Architecture

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

Composite Pattern. IV.4 Structural Pattern

Lecture 20: Design Patterns II

Application Architectures, Design Patterns

Design Patterns Reid Holmes

Tuesday, October 4. Announcements

APPLYING DESIGN PATTERNS TO SCA IMPLEMENTATIONS

Applying the Decorator Design Pattern

Pro Objective-C Design Patterns for ios

What is Design Patterns?

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

Topics. Software Process. Agile. Requirements. Basic Design. Modular Design. Design Patterns. Testing. Quality. Refactoring.

DESIGN PATTERNS MOCK TEST DESIGN PATTERNS MOCK TEST II

Lecture 4: Observer Pattern, Event Library and Componentization

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

The Design Patterns Matrix From Analysis to Implementation

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

TDDB84: Lecture 6. Adapter, Bridge, Observer, Chain of Responsibility, Memento, Command. fredag 4 oktober 13

Design Pattern and Software Architecture: IV. Design Pattern

SWEN425 DESIGN PATTERNS

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

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

Lectures 24 and 25 Introduction to Architectural Styles and Design Patterns

Design Patterns V Structural Design Patterns, 2

Lecture 17: Patterns Potpourri. Copyright W. Howden 1

A Metric of the Relative Abstraction Level of Software Patterns

Information systems modelling UML and service description languages

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

Ownership in Design Patterns. Master's Thesis Final Presentation Stefan Nägeli

Review Software Engineering October, 7, Adrian Iftene

Applying Design Patterns to accelerate development of reusable, configurable and portable UVCs. Accellera Systems Initiative 1

Extensibility Design Patterns From The Initial Stage of Application Life-Cycle

Object-Oriented Design

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

COSC 3351 Software Design. Design Patterns Structural Patterns (I)

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

Overview of Patterns: Introduction

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

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

TDDB84. Lecture 2. fredag 6 september 13

Applying the Factory Method Design Pattern

Applying Some Gang of Four Design Patterns CSSE 574: Session 5, Part 3

An Introduction to Patterns

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

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

UNIT-I. Introduction, Architectural Styles, Shared Information Systems

Design Patterns Revisited

C++ for System Developers with Design Pattern

CS 2720 Practical Software Development University of Lethbridge. Design Patterns

CSE 219 COMPUTER SCIENCE III STRUCTURAL DESIGN PATTERNS SLIDES COURTESY: RICHARD MCKENNA, STONY BROOK UNIVERSITY.

Creational. Structural

THOMAS LATOZA SWE 621 FALL 2018 DESIGN PATTERNS

Writing your own Java I/O Decorator p. 102 Tools for your Design Toolbox p. 105 Exercise Solutions p. 106 The Factory Pattern Baking with OO

A Metric for Measuring the Abstraction Level of Design Patterns

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

Transcription:

Design Patterns: Structural and Behavioural 3 April 2009 CMPT166 Dr. Sean Ho Trinity Western University See also: Vince Huston

Review last time: creational Design patterns: Reusable templates for designing programs May be very high-level, indep. of prog. language Creational patterns Factory method Abstract factory Builder Prototype Singleton 2

Structural patterns Adapter/ wrapper: Convert the interface of a class into another interface clients expect Bridge: split abstraction from implementation Composite: organize objects into trees Decorator: dynamically add responsibilities / functionality to an object Facade: hide complexities behind simple interface Flyweight: use sharing to support large numbers of fine-grained objects efficiently Proxy: surrogate/placeholder for another object 3

Structural pattern: Adapter Convert interface of a class so that two incompatible classes can work together Like converting 3-prong plug to 2-prong socket, or impedance matching electrical signals e.g., buy prepackaged software system, get it working with your existing system e.g., ClassClimate TWU Student Portal 4

Structural pattern: Bridge Decouple an abstraction from its implementation so that the two can vary independently e.g., light switch abstract concept vs. implementation of kinds of switches client abstraction implementor refinement refinement 5

Structural pattern: Composite Tree structure for objects: treat individual objects and composites in the same way e.g., file directories have entries, each of which may themselves be directories e.g., expression trees 6

Structural pattern: Decorator Dynamically add functionality to an object Use a wrapper around the object to hide core Wrapper may be subclassed to add functionality Decorating a Christmas tree 7

Structural pattern: Facade Provide a unified interface to a set of interfaces in a subsystem High-level interface: system is easier to use e.g., web front-end to complex database: want minimal number of widgets, input boxes complex subsystem facade user 8

Structural pattern: Flyweight Use sharing to support lots of small objects When more objects needed, draw from shared pool on demand e.g., multithreaded server: pool of threads e.g., array of bank tellers 9

Structural pattern: Proxy Surrogate for the real object Control access to the real object, but still let clients think they are talking directly to it Use superclass over both real object and proxy e.g., proxy HTTP server e.g., bank cheque 10

Structural patterns Adapter/ wrapper: Convert the interface of a class into another interface clients expect Bridge: split abstraction from implementation Composite: organize objects into trees Decorator: dynamically add responsibilities / functionality to an object Facade: hide complexities behind simple interface Flyweight: use sharing to support large numbers of fine-grained objects efficiently Proxy: surrogate/placeholder for another object 11

Behavioural patterns Chain of responsibility: avoid coupling sender directly to receiver by passing through chain Command: make requests into objects Iterator: access all elements of a collection Mediator: object encapsulating the interactions of a set of objects: promotes loose coupling Observer: decouple viewers from the subject (also: Interpreter, Memento, State, Strategy, Template Method, Visitor) 12

Behavior: Chain of responsibility Decouple sender from receiver by passing request along a chain of intermediate handlers Chain may be reconfigured dynamically Single pipeline, but many possible handlers e.g., coin passing through vending machine me my boss 2 nd level mgr regional mgr vice president CEO 13

Behavioural pattern: Command Encapsulate a request as an object cf. C++ function objects, callbacks Specify: object, method, arguments e.g., meal order at restaurant client callback interface concrete callback receiver concrete callback 14

Behavioural pattern: Iterator Abstract interface to traverse a collection Hide how the collection is stored Client interface: first, next, isdone e.g., secretary knows her own filing system; boss only needs ask for next document Python for loop through dictionaries: Order irrelevant 15

Behavioural pattern: Mediator Simplify many-to-many relationships with one central object that all actors interact with Loose coupling of peers Encapsulate many interactions (e.g., methods) into one object e.g., ATC w/o mediator with mediator 16

Behavioural pattern: Observer One-to-many dependency between objects so that when the subject changes state, all its observers are notified and updated e.g., many students checking TWU website for snow closures e.g., server message send to all clients subject observer observer observer 17

Behavioural patterns Chain of responsibility: avoid coupling sender directly to receiver by passing through chain Command: make requests into objects Iterator: access all elements of a collection Mediator: object encapsulating the interactions of a set of objects: promotes loose coupling Observer: decouple viewers from the subject (also: Interpreter, Memento, State, Strategy, Template Method, Visitor) 18