D ESIGN P ATTERNS Breno Batista Machado Weslei A. de T. Marinho.

Slides:



Advertisements
Similar presentations
Welcome to. Who am I? A better way to code Design Patterns ???  What are design patterns?  How many are there?  How do I use them?  When do I use.
Advertisements

Lecture 9 Design Patterns CSCI – 3350 Software Engineering II Fall 2014 Bill Pine.
(c) 2009 University of California, Irvine – André van der Hoek1June 13, 2015 – 21:42:16 Informatics 122 Software Design II Lecture 8 André van der Hoek.
Dept. of Computer Engineering, Amirkabir University of Tech. 1 Design Patterns Dr. Noorhosseini Introduction.
Design Patterns CS is not simply about programming
Copyright © Active Frameworks, Inc.. - All Rights Reserved - V2.0 Introduction - Page L1-1 PS95&96-MEF-L1-1 Dr. M.E. Fayad Creationa l Paradigm.
Design Patterns. What are design patterns? A general reusable solution to a commonly occurring problem. A description or template for how to solve a problem.
Spring 2010CS 2251 Design Patterns. Spring 2010CS 2252 What is a Design Pattern? "a general reusable solution to a commonly occurring problem in software.
Design Patterns William A. Hoffman NYU OOP Class.
(c) 2010 University of California, Irvine – André van der Hoek1June 29, 2015 – 08:55:05 Informatics 122 Software Design II Lecture 8 André van der Hoek.
ECE 355 Design Patterns Tutorial Part 2 (based on slides by Ali Razavi) Presented by Igor Ivković
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Idioms and Patterns polymorphism -- inheritance and delegation idioms -- realizing.
Design Patterns Alan Shalloway, James Trott, Design Patterns Explained, Addison-Wesley, Gamma, Helm, Johnson, Vlissides, Design Patterns, Elements.
Design Patterns Trends and Case Study John Hurst June 2005.
Design Patterns.
樣式導向設計 (Pattern-Oriented Design) 課程簡介 Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering.
Patterns 1 Patterns in OO - history 77 - Work of the architect Christopher Alexander 80s - Kent Beck playing with Smalltalk 91 - Gamma’s PhD thesis on.
05 - Patterns Intro.CSC4071 Design Patterns Designing good and reusable OO software is hard. –Mix of specific + general –Impossible to get it right the.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
SOEN 6011 Software Engineering Processes Section SS Fall 2007 Dr Greg Butler
January 12, Introduction to Design Patterns Tim Burke References: –Gamma, Erich, et. al. (AKA, The Gang of Four). Design Patterns: Elements of Reusable.
Creational Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
Patterns in programming 1. What are patterns? “A design pattern is a general, reusable solution to a commonly occurring problem in software. A design.
Powerpoint Templates Page 1 Powerpoint Templates What is Design Patterns ? by Indriati Teknik Informatika – UB.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 27. Review UML dynamic view – State Diagrams.
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
Behavioral Design Patterns Morteza Yousefi University Of Science & Technology Of Mazandaran 1of 27Behavioral Design Patterns.
Design Patterns CSCI 5801: Software Engineering. Design Patterns.
D ESIGN P ATTERNS Weslei A. de T. Marinho. T ALK O UTLINE Pattern Definition GRASP Patterns GoF Patterns GoF Patterns Classification Creational Patterns.
DESIGN PATTERNS CSC532 Adv. Topics in Software Engineering Shirin A. Lakhani.
18 April 2005CSci 210 Spring Design Patterns 1 CSci 210.
L11-12: Design Patterns Definition Iterator (L4: Inheritance)‏ Factory (L4: Inheritance)‏ Strategy (L5: Multiple Inheritance)‏ Composite (L6: Implementation.
Software Design Patterns (1) Introduction. patterns do … & do not … Patterns do... provide common vocabulary provide “shorthand” for effectively communicating.
CSE 403 Lecture 14 Design Patterns. Today’s educational objective Understand the basics of design patterns Be able to distinguish them from design approaches.
ECE450S – Software Engineering II
Design Patterns CSIS 3701: Advanced Object Oriented Programming.
1 Design Patterns Object-Oriented Design. 2 Design Patterns 4Reuse of design knowledge and experience 4Common in many engineering disciplines 4Avoids.
CSC 480 Software Engineering Design With Patterns.
Copyright © Active Frameworks Inc. - All Rights Reserved - V2.0Design Pattern Catalog - Page L3-1 PS95&96-MEF-L10-1 Dr. M.E. Fayad Creationa.
CS616: Software Engineering Spring 2009 Design Patterns Sami Taha.
Patterns Roberto Damiani Mendes. Roteiro Definition; Definition; Architecture Patterns; Architecture Patterns; Design Patterns; Design Patterns; GRASP.
Software Design Patterns Curtsy: Fahad Hassan (TxLabs)
Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes.
Stephenson College DP 98 1 Design Patterns by Derek Peacock.
Design Patterns. 1 Paradigm4 Concepts 9 Principles23 Patterns.
Design Patterns Introduction
1 Chapter 5:Design Patterns. 2 What are design pattern?  Schematic description of design solution to recurring problems in software design and,  Reusable.
BEHAVIORAL PATTERNS 13-Sep-2012 Presenters Sanjeeb Kumar Nanda & Shankar Gogada.
CS251 – Software Engineering Lectures 18: Intro to DP Slides by Rick Mercer, Christian Ratliff, Oscar Nierstrasz and others 1 و ابتغ فيما آتاك الله الدار.
Five Minute Design Patterns Doug Marttila Forest and the Trees May 30, 2009 Template Factory Singleton Iterator Adapter Façade Observer Command Strategy.
Engr 691 Special Topics in Engineering Science Software Architecture Spring Semester 2004 Lecture Notes.
CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
Design Patterns: MORE Examples
The Object-Oriented Thought Process Chapter 15
Chapter 10 Design Patterns.
Chapter 5:Design Patterns
Software Design Patterns
Introduction to Design Patterns
Design Patterns Lecture part 2.
Introduction to Design Patterns
Presented by Igor Ivković
Software Engineering Lecture 7 - Design Patterns
Informatics 122 Software Design II
Patterns.
DESIGN PATTERNS : Introduction
Informatics 122 Software Design II
Presented by Igor Ivković
Presentation transcript:

D ESIGN P ATTERNS Breno Batista Machado Weslei A. de T. Marinho

T ALK O UTLINE Pattern Definition GoF Patterns GoF Patterns Classification Creational Patterns Structural Patterns Behavioral Patterns Architectural Patterns Idioms

W HAT IS A P ATTERN ? "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“ (Christopher Alexander)

W HAT IS A P ATTERN ? “Pattern is a named and well-known problem/solution pair that can be applied in new contexts, with advice on how to apply it in novel situations and discussion of its trade-offs, implementations, variations, and so forth.” (Craig Larman)

W HY USE P ATTERNS ? A pattern addresses a recurring design problem that arises in specific design situations, and presents a solution to it. Patterns document existing, well-proven design experience. Patterns identify and specify abstractions that are above the level of single classes and instances, or of components. Patterns provide a common vocabulary and understanding for design principles Patterns are a means of documenting software architectures.

T YPES OF P ATTERNS Architectural Patterns Design Patterns Idioms … E.g.: Usability Patterns Anti-Patterns

B ASIC P ATTERN M ETAMODEL Problem Solution Consequence Pattern name *

T HE S ACRED E LEMENTS OF THE F AITH FM Factory Method 107 PT Prototype 117 AF Abstract Factory 87 BU Builder 97 S Singleton 127 The role origins (Creational) CP Composite 163 PX Proxy 207 A Adapter 139 D Decorator 175 FA Facade 185 BR Bridge 151 The role structure FL Flyweight 195 CR Chain of Responsibility 223 TM Template Method 325 SR Strategy 315 CD Command 233 MM Memento 283 MD Mediator 273 ST State 305 O Observer 293 IT Iterator 257 IN Interpreter 243 V Visitor 331 The role behaviors

G O F P ATTERNS C LASSIFICATION Table 1: Design pattern space Purpose CreationalStructuralBehavioral Scope Class Factory MethodAdapterInterpreter Template Method Object Abstract FactoryAdapterChain of Responsibility BuilderBridgeCommand PrototypeCompositeIterator SingletonDecoratorMediator FacadeMemento ProxyFlyweight Observer State Strategy Visitor

A BSTRACT F ACTORY Intent: Provide an interface for creating families of related or dependent objects without specifying their concrete classes. Also Knows As: Kit

A BSTRACT F ACTORY - M OTIVATION

A BSTRACT F ACTORY - S TRUCTURE

S IGLETON Intent: Ensure a class only has one instance, and provide a global point of access to it.

S INGLETON

A DAPTER

F ACADE Intent: 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.

F ACADE

T EMPLATE M ETHOD Intent: Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template Method lets subclasses redefine steps of an algorithm changing the algorithm’s structure.

T EMPLATE M ETHOD Motivation: Think about to prepare coffee and tea.

T EMPLATE M ETHOD Structure

T EMPLATE M ETHOD Structure

T EMPLATE M ETHOD Consequences: Template Method prove code reuse It lead to an inverted control structure: “the Hollywood principle” that says “Don’t call us, we’ll call you.”

O BSERVER Intent: Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. Also Know As: Dependents, Publish-Subscribe Motivation: Maintain a consistency between objects in a system that is partitioned into a collection of cooperating classes.

O BSERVER

Consequences: Support for broadcast communication Unexpected updates

A RCHITECTURAL P ATTERNS It expresses a fundamental structural organization schema for software systems. It provides a set of predefined subsystems, specifies their responsibilities, and includes rules and guidelines for organizing the relationships between them.

A RCHITECTURAL P ATTERNS We’ll see… Layers Model View Controller

L AYERS It helps to structure applications that can be decomposed into groups of subtasks in which each group of subtasks is at a particular level of abstraction. Example: Networking Protocols. Context: A large system that requires decomposition.

L AYERS Structure Individual Layer Layers collaborating

L AYERS Consequences: Reuse of layers Support for standardization Dependencies are kept local Exchangeability Cascades of changing behavior Lower efficiency Difficulty of establishing the correct granularity of layers

M ODEL -V IEW -C ONTROLLER It divides an interactive application into three components. The model contains the core functionality and data. Views display information to the user. Controllers handle user input. Example: A system for political elections with many representations. Context: Interactive applications with a flexible human-computer interface

M ODEL -V IEW -C ONTROLLER Structure

M ODEL -V IEW -C ONTROLLER Structure

M ODEL -V IEW -C ONTROLLER Consequences: Multiple views of the same model Synchronized views “Plugglable” views and controllers Increased complexity Potential for excessive number of updates Intimate connection between view and controller Close coupling of views and controller to a model

I DIOMS Idioms are low-level patterns specific to a programming language. An idiom describes how to implement particular aspects of components or the relationships between them with the features of the giver language. Idioms provides a help to solve some recurring problem with a programming language. Ex. Memory management, object creation, naming of methods, source cod formatting and so on.

B IBLIOGRAPHY Freeman, E., Sierra, K., Bates, B Head First Design Patterns. O’Reilly Media, Inc. Gamma, E., Helm, R., Johnson, R., Vlissides, J Design Patterns Elements of Reusable Object-Oriented Software. Addison-Wesley Pub Co. Larman, C Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development, Third Edition. Pearson Education, Inc. Schmidt, D., Stal, M., Rohnert, H., Buschmann, F PATTERN-ORIENTED SOFTWARE ARCHITECTURE VOLUME 1: A System of Patterns. John Wiley & Sons Ltd.