Introduction to Software Engineering: Object Design I Reuse & Patterns

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

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

SDC Design patterns GoF

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

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

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

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

Object-Oriented Oriented Programming

Object-oriented Software Design Patterns

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

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

UNIT I Introduction to Design Patterns

Using Design Patterns in Java Application Development

Design Patterns Reid Holmes

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

A Reconnaissance on Design Patterns

Design Patterns. SE3A04 Tutorial. Jason Jaskolka

DESIGN PATTERN - INTERVIEW QUESTIONS

UNIT I Introduction to Design Patterns

Object Oriented Paradigm

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

Design Patterns. An introduction

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

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

A few important patterns and their connections

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

Brief Note on Design Pattern

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

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

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

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

Design Pattern and Software Architecture: IV. Design Pattern

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

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

Tuesday, October 4. Announcements

What is Design Patterns?

Design patterns. Jef De Smedt Beta VZW

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

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

Application Architectures, Design Patterns

Summary of the course lectures

1 Software Architecture

The Design Patterns Matrix From Analysis to Implementation

Design Patterns: Structural and Behavioural

THOMAS LATOZA SWE 621 FALL 2018 DESIGN PATTERNS

Information systems modelling UML and service description languages

Chapter 8, Design Patterns Visitor

Lecture 20: Design Patterns II

Composite Pattern. IV.4 Structural Pattern

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

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

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

Topics in Object-Oriented Design Patterns

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: Template Method Pattern. George Blankenship

WS01/02 - Design Pattern and Software Architecture

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

Design Patterns Reid Holmes

Lecture 4: Observer Pattern, Event Library and Componentization

Pro Objective-C Design Patterns for ios

Software Eningeering. Lecture 9 Design Patterns 2

MVC. Model-View-Controller. Design Patterns. Certain programs reuse the same basic structure or set of ideas

INSTITUTE OF AERONAUTICAL ENGINEERING

Design Patterns Lecture 2

Applying Design Patterns to SCA Implementations

Software Development Project. Kazi Masudul Alam

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

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

Overview of Patterns: Introduction

A Case Study of Gang of Four (GoF) Patterns: Part 3

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

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

APPLYING DESIGN PATTERNS TO SCA IMPLEMENTATIONS

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

Overview CS Kinds of Patterns. Design Pattern. Factory Pattern Rationale. Kinds of Factory Patterns

CS/CE 2336 Computer Science II

Applying the Observer Design Pattern

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

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

3 Product Management Anti-Patterns by Thomas Schranz

Lectures 24 and 25 Introduction to Architectural Styles and Design Patterns

CS560. Lecture: Design Patterns II Includes slides by E. Gamma et al., 1995

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

TDDB84. Lecture 2. fredag 6 september 13

Patterns. Erich Gamma Richard Helm Ralph Johnson John Vlissides

A Rapid Overview of UML

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

CS251 Software Engineering Lectures 18: Intro to DP

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 Engineering Prof. Rushikesh K.Joshi IIT Bombay Lecture-15 Design Patterns

Design Patterns. (and anti-patterns)

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

Reuse at Design Level: Design Patterns

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

Design patterns. Valentina Presutti courtesy of Paolo Ciancarini

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

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

Object-Oriented Design

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

Transcription:

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, and Design Patterns by Gamma et. Al. Design Through Reuse Many design problems have been solved before. Libraries, Frameworks, COTS, are all approaches to reusing code. Architectures and Design Patterns are approaches to reusing concepts and ideas. Design Patterns are well-documented solutions to commonly encountered ( OO ) design problems. The classic source is by Gamma et. al. 2 1

THE Classic Design Patterns Book 3 Documentation for all Patterns 4 2

Design Pattern Classification Purpose Creational Structural Behavioral Scope Class Factory Method (107) Adapter (139) Interpreter (243) Template Method (325) Object Abstract Factory (87) Builder (97) Prototype (117) Singleton (127) Adapter (139) Bridge (151) Composite (163) Decorator (175) Facade (185) Proxy (207) Chain of Responsibility (223) Command (233) Iterator (257) Mediator (273) Memento (283) Flyweight (195) Observer (293) State (305) Strategy (315) Visitor (331) 5 Creational Patterns 6 3

Structural Patterns 7 Behavioral Patterns 1 / 2 8 4

Behavioral Patterns 2 / 2 9 The Design Pattern Triangle Name (Classification) Description Implementation Given any one, provide the other two 10 5

Creational Patterns 13 Singleton Ensure Only 1 Instance AND provide universal access to it. 14 6

Prototype makes copies of objects using overriding and polymorphism. Does not require knowing what type of object will be created when writing code. Implemented in Java as Object.clone( ). 15 Factory Method creates a related object, type determined dynamically Example: A Lock class could contain a getkey( ) method. ComboLock creates ComboKey, BikeLock creates BikeKey, etc. 16 7

Abstract Factory class produces many things, all designed to work together 17 Builder creates a complex structure step-by-step, and delivers the result 18 8

Name That Pattern Provide an interface for creating families of related or dependent objects without specifying their concrete classes. A. Abstract Factory B. Factory C. Factory Method D. Family E. Builder 19 Structural Patterns 20 9

Adapter is used to connect two pre-existing classes. Class Approach: Object Approach: 21 Bridge separates interface from implementation, for 2 new classes 22 10

Composite creates hierarchical trees, with grouping nodes and leaf nodes 23 A Composite can have different kinds of grouping nodes ( uses Flyweight ) 24 11

Proxy A local stand-in taking the place of a remote resource. Note: Client only knows about Subject, which is abstract Uses: Speedup, Caching, Security, Smart pointers, more. Note: Proxy and RealSubject are siblings, both descendants of Subject 25 Decorator combines functionality in a daisy-chain fashion 26 12

Behavioral Patterns 1 / 2 27 Command encapsulates actions. Useful for undo/redo histories & macros. 28 13

Iterator is frequently used with Composite, and other collections 29 Iterator Example 30 14

Mediator coordinates between classes that don t need to know each other 31 What Does Command Do? A. Delegate a request to a subordinate class. B. Encapsulate requests as objects, providing support for undoing, queueing or logging requests. C. Explore a daisy-chain of potential handlers to find the best handler to service a request. D. Provide a surrogate or placeholder for another object to control access to it. E. Provide a unified interface to a set of interfaces in a subsystem. 32 15

Behavioral Patterns 2 / 2 33 Memento remembers a state without violating privacy / info hiding 34 16

Observer Gets notifications when changes occur. 35 Observer Implements MVC 36 17

State subclasses finite states 37 Strategy allows different algorithms using a common interface ( e.g. sort ) 38 18

Template encapsulates an algorithm while deferring specific steps to children 39 Visitor with collections allows for flexibility in both nodes and actions Each Visitor has methods for each type of node it knows how to visit See close-up next slide Iterator applied here, to pass Visitor to each node in turn. Each node has a method to Accept a Visitor, which it implements by passing itself to the appropriate Visitor method for that node type. 40 19

Visitor Hierarchy Multiplexes Over Both Node Types and Action Types Different concrete visitor classes handle different tasks. E.g. printing, spell-checking, intersection testing, etc. Different methods within each class get called by different node types. 41 Visitor in practice The application uses Iterator to move from node to node, passing the Visitor to each Accept method 42 20

Name that Pattern A. Builder B. Composite C. Façade D. Proxy E. Tree 43 What Type of Pattern is Memento? A. Abstract B. Behavioral C. Creational D. Forgetful E. Structural 44 21

Open-Ended Name and describe a design pattern that you have used in a project, either this semester or at some other time. Provide a UML diagram illustrating its use in your project. Which is your favorite design pattern that we have studied this semester? Explain what you like about it. 45 22