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.

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

18-1 Verifying Object Behavior and Collaboration Role playing – the act of simulating object behavior and collaboration by acting out an object’s behaviors.
(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.
Design and Programming Patterns Associated with Java Networking by Margaret Toews cs843, Spring 2003.
Design Patterns CS is not simply about programming
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.
Ralph Johnson - University of Illinois1 Patterns: What They Are, and How to Write Them Ralph Johnson University of Illinois at Urbana-Champaign
Fall 2009ACS-3913 Ron McFadyen1 idea was first put forth by Christopher Alexander (1977) in his work on architectural design principles a pattern is a.
Visual Basic: An Object Oriented Approach 11 – Patterns in object oriented programming.
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.
Design Patterns Module Name - Object Oriented Modeling By Archana Munnangi S R Kumar Utkarsh Batwal ( ) ( ) ( )
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
(c) 2010 University of California, Irvine – André van der Hoek1July 16, 2015 – 13:45:31 Informatics 122 Software Design II Lecture 8 Nick Lopez Duplication.
Şabloane de Proiectare Daniel POP, Ph.D. 2 The Plan Introducing fundamental patterns (today) 18 design patterns will be covered based on the case study.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
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.
05 - Patterns Intro.CSC4071 Design Patterns Designing good and reusable OO software is hard. –Mix of specific + general –Impossible to get it right the.
CSSE 374: Introduction to Gang of Four Design Patterns
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris
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.
Design Patterns in Java Chapter 1 Introduction Summary prepared by Kirk Scott 1.
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.
Design Patterns. Patterns “Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution.
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.
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.
Design Patterns CS 124 Reference: Gamma et al (“Gang-of-4”), Design Patterns.
Design Principle & Patterns by A.Surasit Samaisut Copyrights : All Rights Reserved.
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.
What to know for the exam. Smalltalk will be used for questions, but there will not be questions about the grammar. Questions might ask – how particular.
Copyright © Active Frameworks Inc. - All Rights Reserved - V2.0Design Pattern Catalog - Page L3-1 PS95&96-MEF-L10-1 Dr. M.E. Fayad Creationa.
Advanced Object-Oriented Design Patterns and Architectures Part One COEN396A John Xiao
Design Patterns. 1 Paradigm4 Concepts 9 Principles23 Patterns.
Design Patterns Introduction
Using Software Design Patterns Bill Anderson. About me Fox developer since 1987 Fox developer since 1987 Program Director, Los Angeles Visual Foxpro Developers.
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 و ابتغ فيما آتاك الله الدار.
Design Patterns in Context ©SoftMoore ConsultingSlide 1.
Five Minute Design Patterns Doug Marttila Forest and the Trees May 30, 2009 Template Factory Singleton Iterator Adapter Façade Observer Command Strategy.
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
MPCS – Advanced java Programming
Introduction to Design Patterns
Design Patterns Lecture part 2.
Introduction to Design Patterns
Design Patterns Introduction
object oriented Principles of software design
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2005 Instructor: Patrice Chalin.
Software Engineering Lecture 7 - Design Patterns
Informatics 122 Software Design II
DESIGN PATTERNS : Introduction
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Informatics 122 Software Design II
Chapter 8, Design Patterns Introduction
Presentation transcript:

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 ET Coad’s patterns paper 92 - Johnson’s OOPSLA paper 93 - OOPSLA workshop Coad & Anderson 93 - Patterns discussion group on WWW 94 - First PLoP conference 95 - Gang of four book (first draft at OOPSLA 93)

Patterns 2 Christopher Alexander Alexander,C., Ishikawa, S. & Silverstein, M., A Pattern Language, Oxford University Press 1977 This text is handbook of patterns to be used in the construction of built environments. “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 presented 253 patterns in 35 groups at different levels of abstraction or resolution.

Patterns 3 The structure of a pattern Each pattern is presented in the same format for clarity, ease of navigation etc. Name. A Short descriptive phrase. Picture. Followed by an introductory paragraph to outline the context. Problem. An outline of the problem that the pattern aims to solve. Solution. The heart of the pattern, a description of how to solve the problem. Interconnections. The other patterns which are related to this one.

Patterns 4 Some typical examples Intimacy Gradient Common Areas at the Heart Eating Atmosphere Roof Layout Pools of Light

Patterns 5 Peter Coad’s patterns Coad, P., Object-Oriented Patterns, Communications of the ACM Vol 35 No. 9 September 1992 "An object-oriented pattern is an abstraction of a doublet, triplet, or other small grouping of classes that is likely to be helpful again and again in object-oriented development." Coad’s patterns originally had a focus on OOA.

Patterns 6 Patterns and layers Service Layer Item Description Time Association Event Logging Attribute Layer State across a collection Behaviour across a collection Roles Played Broadcast pattern

Patterns 7 Event logging Use whenever an event is detected and you need to log its occurence

Patterns 8 Larman’s GRASP patterns Larman proposes a small set of (what he calls) patterns for assigning responsibilities to classes. General Responsibility Assignment Software Patterns. Expert, Creator, Low Coupling, High Cohesion, Polymorphism, Pure Fabrication, Indirection and Don’t Talk to Strangers.

Patterns 9 Grasp 1 Expert - assign the responsibility to the class that has the information necessary to fulfill the responsibility. Creator - Assign B the responsibility to create an A if.. B aggregates or contains A objects B records instances of A objects B closely uses A objects B has the initialising data that A needs (expert) Low coupling - Assign a responsibility so that coupling remains low. High cohesion - Assign a responsibility so that cohesion remains high.

Patterns 10 Grasp 2 Polymorphism - When behaviours vary by type, assign responsibilities (using polymorphism) to the type with the variation. Pure Fabrication - Invent a cohesive class which is not in the problem domain to further low coupling. Indirection - Assign the responsibility to an intermediate object to mediate between components so that they are not directly coupled. Don’t talk to strangers - The Law of Demeter

Patterns 11 Gang of Four Gamma, E., Helm, R., Johnson, R., Vlissides, J., Design Patterns: Elements of Reusable Object-Oriented Software Addison-Wesley Work started with Gamma’s doctoral thesis and continued for a couple of years. The final published book shows signs of evolution from the earliest drafts. You should try to read chapter 2. There are 25 patterns arranged under 3 headings

Patterns 12 Gang of four - format Pattern Name and Classification Intent Also known as Motivation Applicability Structure Participants Collaborations Consequences Implementation Sample code Known uses Related Patterns

Patterns 13 Design Pattern Space Factory Method Abstract Factory Builder Prototype Singleton Adapter (class) Adapter (object) Bridge Composite Decorator Facade Flyweight Proxy Interpreter Template Method Chain of Responsibility Command Iterator Mediator Memento Observer State Strategy Visitor Creational StructuralBehavioural Purpose Scope Class Object

Patterns 14 Strategy pattern Intent. Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it. Context Strategy ContextInterface() ConcreteStrategyA AlgorithmInterface() ConcreteStrategyB ConcreteStrategyC AlgorithmInterface() Motivation A text compositor with a number of line breaking algorithms Structure

Patterns 15 Observer pattern outline abc x y z a b c a b c a = 50% b = 30% c = 20% Change notification requests, modifications

Patterns 16 Observer pattern

Patterns 17 Observer details Defines a one to many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. Used when you need to maintain consistency between objects. Particularly used in GUI development, it is the basis for Smalltalk’s Model-View-Controller. Also known as Dependents or Publish-Subscribe.

Patterns 18 Abstract Factory Used to provide an interface for creating families of related or dependent objects without specifying their concrete classes. Java uses this pattern in its AWT for creating platform specific objects with the correct look and feel. (Peers)

Patterns 19 Abstract factory

Patterns 20 Patterns and design skills If patterns capture design expertise, then learning patterns makes me an expert designer. Teaching patterns to beginners can help them become better designers. How do I know when to apply a pattern, Riel argues that design heuristics may tell me? Are there such things as anti-patterns? Examples of bad practice to be avoided. A. J. Riel Object-Oriented Design Heuristics Addison-Wesley 1996

Patterns 21 Patterns and reuse The focus was never on component reuse but on the reuse of design ideas and insights. Patterns are increasingly becoming specialised to problem domains, apparently losing generality. Might patterns provide accelerated familiarity with domains for designers? Documenting patterns is hard work, are they worth building?

Patterns 22 The scope and granularity of patterns Scope Coad’s analysis patterns versus Gamma’s design patterns Granularity Coplien’s idioms for C++ Gamma’s patterns Frameworks - implemented patterns

Patterns 23 References Lea, D., Christopher Alexander: An Introduction for Object-Oriented Designers SIGSOFT Jan (lots of references) Beck, K., et al Industrial Experience with Design Patterns proceedings of ICSE Larman, C. Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design Prentice Hall