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

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

Design Patterns. An introduction

Using Design Patterns in Java Application Development

SDC Design patterns GoF

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

Design Patterns. Gunnar Gotshalks A4-1

CS/CE 2336 Computer Science II

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

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

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

Object-Oriented Design

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

Object-Oriented Oriented Programming

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

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

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

Applying the Observer Design Pattern

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

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

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

CS251 Software Engineering Lectures 18: Intro to DP

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

Object-Oriented Design

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

Tuesday, October 4. Announcements

What is Design Patterns?

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

Applying the Decorator Design Pattern

A Reconnaissance on Design Patterns

DESIGN PATTERN - INTERVIEW QUESTIONS

UNIT I Introduction to Design Patterns

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

Patterns. Erich Gamma Richard Helm Ralph Johnson John Vlissides

Introduction and History

3 Product Management Anti-Patterns by Thomas Schranz

A Rapid Overview of UML

Review Software Engineering October, 7, Adrian Iftene

UNIT I Introduction to Design Patterns

1 Software Architecture

Object-oriented Software Design Patterns

Topics in Object-Oriented Design Patterns

Introduction to Software Engineering: Object Design I Reuse & Patterns

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

An Introduction to Patterns

Applying the Factory Method Design Pattern

Software Engineering I (02161)

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

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

Application Architectures, Design Patterns

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

The GoF Design Patterns Reference

Crash course on design patterns

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

An Introduction to Patterns

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

What is Design Patterns?

Applying Design Patterns to SCA Implementations

Overview of Patterns: Introduction


2.1 Design Patterns and Architecture (continued)

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

Lectures 24 and 25 Introduction to Architectural Styles and Design Patterns

Design patterns. Jef De Smedt Beta VZW

INSTITUTE OF AERONAUTICAL ENGINEERING

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

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

DESIGN PATTERNS FOR MERE MORTALS

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

Design Patterns. SE3A04 Tutorial. Jason Jaskolka

Object Oriented Paradigm

Coordination Patterns

Design Patterns Reid Holmes

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

CPSC 310 Software Engineering. Lecture 11. Design Patterns

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

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

Chapter 12 (revised by JAS)

2.1 Design Patterns and Architecture (continued)

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

APPLYING DESIGN PATTERNS TO SCA IMPLEMENTATIONS

WS01/02 - Design Pattern and Software Architecture

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

A Primer on Design Patterns

6.3 Patterns. Definition: Design Patterns

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

Brief Note on Design Pattern

Reuse at Design Level: Design Patterns

Design patterns. OOD Lecture 6

What is Design Patterns?

Information systems modelling UML and service description languages

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

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

Design patterns. Valentina Presutti courtesy of Paolo Ciancarini

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

Design Patterns: Structural and Behavioural

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

CSC7203 : Advanced Object Oriented Development. J Paul Gibson, D311. Design Patterns

Why a Design Pattern. History of Design Pattern. Properties

Design Patterns. CSC207 Fall 2017

Composite Pattern. IV.4 Structural Pattern

Transcription:

Ingegneria del Software Corso di Laurea in Informatica per il Management Design Patterns part 1 Davide Rossi Dipartimento di Informatica Università di Bologna

Pattern Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice [Alexander 77]

Design Pattern Patterns provide workable solutions to all of the problems known to arise in the course of design. [Beck, Cunningham - 87] A named description of a problem, solution, when to apply the solution, and how to apply the solution in new contexts. [Larman] A general reusable solution to a commonly occurring problem within a given context in software design [wikipedia]

Languages and catalogs Patterns are usually grouped into a coherent structure with its own vocabulary, syntax (context) and grammar (use). Patterns are linked so the adoption of one suggests other to consider.

Patterns catalogs The are several existing catalogs for patterns in software engineering. We will focus on design patterns. There are several existing catalogs for design patterns too. We will present design patterns from Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides (the Gang of Four) - 1994.

Documentation Pattern Name and Classification: A descriptive and unique name that helps in identifying and referring to the pattern. Intent: A description of the goal behind the pattern and the reason for using it. Also Known As: Other names for the pattern. Motivation (Forces): A scenario consisting of a problem and a context in which this pattern can be used.

Documentation Applicability: Situations in which this pattern is usable; the context for the pattern. Structure: A graphical representation of the pattern. Class diagrams and Interaction diagrams may be used for this purpose. Participants: A listing of the classes and objects used in the pattern and their roles in the design. Collaboration: A description of how classes and objects used in the pattern interact with each other.

Documentation Consequences: A description of the results, side effects, and trade offs caused by using the pattern. Implementation: A description of an implementation of the pattern; the solution part of the pattern. Sample Code: An illustration of how the pattern can be used in a programming language. Known Uses: Examples of real usages of the pattern. Related Patterns: Other patterns that have some relationship with the pattern; discussion of the differences between the pattern and similar patterns.

GoF patterns purposes Creational abstract the instantiation process Structural are concerned with how classes and objects are composed to form larger structures Behavioral are concerned with algorithms and the assignment of responsibilities between objects

The 23 Creational: Abstract Factory, Builder, Factory Method, Prototype, Singleton Structural: Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy Behavioral: Chain of responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template method, Visitor

Template Method Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure.

Template Method

Factory Decouples client from instantiation process Refers to the newly created object through a common interface

Factory method Define an interface for creating an object, but let subclasses decide which class to instantiate Factory Method lets a class defer instantiation to subclasses

Factory Method

Strategy Define a family of algorithms, encapsulate each one, and make them interchangeable Strategy lets the algorithm vary independently from clients that use it

Façade 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.

Observer Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

Singleton Ensure a class only has one instance, and provide a global point of access to it.

Singleton Beware of singletons (code smell)! Ensure that only one instance of a class is created Provide a global point of access to the object

Singleton candidates Factories Loggers Configuration classes Resource access Classes that have no non-static attributes nor any associations that are navigable away from their instances

Singleton unlikely candidates Classes for which a single instance is part of the specification but is not intrinsic to the problem domain Objects that should be globally accessible

Resources http://www.vincehuston.org/dp/ http://www.oodesign.com/ http://www.informit.com/articles/article.aspx?p=1404056