Patterns and AntiPatterns Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.

Slides:



Advertisements
Similar presentations
ANU COMP2110 Software Design in 2003 Lecture 16Slide 1 Lecture 16: Introduction to design patterns 1What are they? 2Where do they come from? 3Why study.
Advertisements

Object-Oriented Design Patterns Composite Singleton State Observer … Autumn 2012UCN Technology: IT/Computer Science1.
CS590L - Lecture 6 1 CS590L Distributed Component Architecture References: - E. Gamma, R. Helm, R. Johnson, J. Vlissides, Design Patterns: Elements of.
Broker Pattern Pattern-Oriented Software Architecture (POSA 1)
Design Patterns Yes, they are important Robert Cotton April 23, 2009.
Introduction To System Analysis and Design
05/26/2004www.indyjug.net1 Indy Java User’s Group June Knowledge Services, Inc.
Design Patterns In OPM Presented by: Galia Shlezinger Instructors: Prop. Dov Dori, Dr. Iris Berger.
Dept. of Computer Engineering, Amirkabir University of Tech. 1 Design Patterns Dr. Noorhosseini Introduction.
Design Patterns CS is not simply about programming
Design Patterns Daniel McClain. Background What are they?  Way of recording solutions to recurring design problems History  “A Pattern Language: Towns,
Ralph Johnson - University of Illinois1 Patterns: What They Are, and How to Write Them Ralph Johnson University of Illinois at Urbana-Champaign
James Tam Introduction To Design Patterns You will learn about design techniques that have been successfully applied to different scenarios.
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.
WEL COME PRAVEEN M JIGAJINNI PGT (Computer Science) MCA, MSc[IT], MTech[IT],MPhil (Comp.Sci), PGDCA, ADCA, Dc. Sc. & Engg.
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.
Introduction to software design patterns For CSE 3902 By: Matt Boggus.
Design Patterns Introduction. What is a Design Pattern?  A technique to repeat designer success.  Borrowed from Civil and Electrical Engineering domains.
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.
Chapter 7 GRASP patterns Dr Seham Mostefai CAP 252.
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
Software Design Refinement Using Design Patterns Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
樣式導向設計 (Pattern-Oriented Design) 課程簡介 Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering.
Chapter Five An Introduction to Design Patterns Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
Introduction To System Analysis and Design
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.
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.
A Reference Model for Event Patterns Christian Silberbauer
Object-Oriented Design Principles and Patterns. © 2005, James R. Vallino2 How Do You Design? What principles guide you when you create a design? What.
D ESIGN P ATTERNS Weslei A. de T. Marinho. T ALK O UTLINE Pattern Definition GRASP Patterns GoF Patterns GoF Patterns Classification Creational Patterns.
Detecting Patterns and Antipatterns in Software using Prolog Rules Alecsandar Stoianov, Ioana Sora Department of Computers Politehnica University of Timisoara,
Software Design Patterns (1) Introduction. patterns do … & do not … Patterns do... provide common vocabulary provide “shorthand” for effectively communicating.
Design Patterns Introduction General and reusable solutions to common problems in software design SoftUni Team Software University
Design Principle & Patterns by A.Surasit Samaisut Copyrights : All Rights Reserved.
ECE450S – Software Engineering II
Design Patterns -- Omkar. Introduction  When do we use design patterns  Uses of design patterns  Classification of design patterns  Creational design.
CSC 480 Software Engineering Design With Patterns.
Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes.
Advanced Object-Oriented Design Patterns and Architectures Part One COEN396A John Xiao
Chapter 21 Design Patterns Reviewed from the New Perspective of Object-Oriented Design Ku-Yaw Chang Assistant Professor, Department.
Design Patterns: Elements of Reusable Object- Orientated Software Gamma, Helm, Johnson, Vlissides Presented By: David Williams.
Design Patterns. 1 Paradigm4 Concepts 9 Principles23 Patterns.
CS251 – Software Engineering Lectures 18: Intro to DP Slides by Rick Mercer, Christian Ratliff, Oscar Nierstrasz and others 1 و ابتغ فيما آتاك الله الدار.
Chapter Eight Expanding Our Horizons Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering.
Chapter Ten The Bridge Pattern Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh.
Duke CPS Programming Heuristics l Identify the aspects of your application that vary and separate them from what stays the same ä Take what varies.
1 Good Object-Oriented Design Dr. Radu Marinescu Lecture 4 Introduction to Design Patterns.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
Design Patterns: MORE Examples
The Object-Oriented Thought Process Chapter 15
樣式導向設計 (Pattern-Oriented Design) 課程簡介
Software Design Patterns
Introduction to Design Patterns
Design Patterns Introduction
Software Engineering Lecture 7 - Design Patterns
Informatics 122 Software Design II
Patterns.
DESIGNING YOUR SYSTEM.
DESIGN PATTERNS : Introduction
What to Expect from Design Patterns
Design Patterns Imran Rashid CTO at ManiWeber Technologies.
Informatics 122 Software Design II
Chapter 8, Design Patterns Introduction
Presentation transcript:

Patterns and AntiPatterns Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University

22004/05/21Patterns and AntiPatterns Outline Background Structured v.s. Object-Oriented Paradigm Structured v.s. Object-Oriented ParadigmPatterns Command CommandAntiPatterns BLOB BLOBSummaryReferences

32004/05/21Patterns and AntiPatterns Background Paradigm A way of organizing system abstractions around properties of commonality and variation.

42004/05/21Patterns and AntiPatterns Background Paradigm Abstraction To focus on the general and put aside the specific. To focus on the general and put aside the specific. To emphasize what is common and deemphasize details To emphasize what is common and deemphasize details

52004/05/21Patterns and AntiPatterns Background Paradigm Commonality The Essence of Abstraction The Essence of Abstraction To search for common elements that helps us understand how family members are the same. To search for common elements that helps us understand how family members are the same.Variability The Spice of Abstraction The Spice of Abstraction Being monotonous without variability. Being monotonous without variability.

62004/05/21Patterns and AntiPatterns Background Paradigm A way of organizing system abstractions around properties of commonality and variation. Commonality Commonality The backbone and skeleton of design Variability Variability The flesh and blood

72004/05/21Patterns and AntiPatterns Background Paradigm Before 1975 No specific techniques No specific techniques 1975 – 1985 Structured Paradigm Structured Paradigm Functional Decomposition 1985 – 2004 Object-Oriented Paradigm Object-Oriented Paradigm

82004/05/21Patterns and AntiPatterns Structured v.s. Object-Oriented Paradigm account balance withdrawdeposit determine balance account balance deposit withdraw determine balance message

92004/05/21Patterns and AntiPatterns Background True Object Orientation Alan Shalloway The objects in my code were well-formed and tightly encapsulated. I could design excellent data abstractions for inheritance hierarchies. I thought I knew object-orientation. The objects in my code were well-formed and tightly encapsulated. I could design excellent data abstractions for inheritance hierarchies. I thought I knew object-orientation. Now, looking back, I see that I really did not understand the full capabilities of object- oriented design. Now, looking back, I see that I really did not understand the full capabilities of object- oriented design. I know there was a better design. I just couldn’t see it. I know there was a better design. I just couldn’t see it.

102004/05/21Patterns and AntiPatterns Patterns Having roots in the architecture field by Christopher Alexander

112004/05/21Patterns and AntiPatterns Patterns

122004/05/21Patterns and AntiPatterns Patterns

132004/05/21Patterns and AntiPatterns Patterns Expert behavior do not try to find the solution from first principles do not try to find the solution from first principles reuse the essence of a proven solution to solve the new problem reuse the essence of a proven solution to solve the new problem

142004/05/21Patterns and AntiPatterns Patterns Being applied to the software development successfully, especially in the object-oriented community Software reuse Code reuse Code reuse Design reuse Design reuse the value of design experience Layers : OSI 7-Layer Model

152004/05/21Patterns and AntiPatterns What is a Pattern? Christopher Alexander 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. 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. Be applied in developing software in Enter the mainstream of OO community in 1994(1st PLoP)

162004/05/21Patterns and AntiPatterns PLoP Conferences Pattern Languages of Program PLoP PLoP Chili PLoP Chili PLoP Euro PLoP Euro PLoP Koala PLoP Koala PLoP Mensore PLoP Mensore PLoP SugarLoaf PLoP SugarLoaf PLoP Viking PLoP Viking PLoP OOPSLA OOPSLA ECOOP ECOOP Allerton Park

172004/05/21Patterns and AntiPatterns Patterns What is a Pattern? Four Essential Elements pattern name pattern name easier to think and to communicate problem problem explain the problem and its context describe when to apply solution solution describe the elements their relationships, responsibilities, and collaborations consequence consequence results and trade-offs

182004/05/21Patterns and AntiPatterns Pattern Example Pattern Name Command Command Pattern Problem different request different request queue or log request queue or log request support undoable operations support undoable operations

192004/05/21Patterns and AntiPatterns Pattern Example Solution (UML)

202004/05/21Patterns and AntiPatterns Pattern Example Consequences Decouples the object that invokes the operation from the one that knows how to perform it. Decouples the object that invokes the operation from the one that knows how to perform it. Commands can be manipulated and extended like any other object. Commands can be manipulated and extended like any other object. Assemble commands into a composite command. Assemble commands into a composite command. Easy to add new Commands. You don’t have to change existing classes. Easy to add new Commands. You don’t have to change existing classes.

212004/05/21Patterns and AntiPatterns Non-software Pattern Example Solution

222004/05/21Patterns and AntiPatterns GoF - 94 Creational Patterns Abstract Factory Abstract Factory Singleton Singleton Structural Patterns Decorator Decorator Behavioral Patterns Command Command Pattern Categories

232004/05/21Patterns and AntiPatterns POSA (Vol. One) - 96 Architectural MVC / Doc-View MVC / Doc-View Broker BrokerDesign Proxy ProxyIdioms Pattern Categories

242004/05/21Patterns and AntiPatterns POSA (Vol. Two) Service Access and Configuration Event Handling SynchronizationConcurrency Pattern Categories

252004/05/21Patterns and AntiPatterns Obsessive use of 1 pattern There are more than 160 fundamental patterns: 23 Gamma Patterns 23 Gamma Patterns 33 Buschmann Patterns (16+17) 33 Buschmann Patterns (16+17) 72 Analysis Patterns 72 Analysis Patterns 38 CORBA Design Patterns 38 CORBA Design Patterns …. ….

262004/05/21Patterns and AntiPatterns Bright and Dark Sides Bright side Reuse of proven good designs Reuse of proven good designs Can be applied in constructing new software Can be applied in constructing new software Dark side Fail to properly evaluate a pattern Fail to properly evaluate a pattern Difficult to be applied to existing systems Difficult to be applied to existing systems

272004/05/21Patterns and AntiPatterns The Truth about Software Technology 84% of software projects are unsuccessful. Vendors Our new technology changes the whole paradigm. We’ll have all the features you need in six months. We make no warranty express. If it does something bad, it’s not their fault. Proprietary technologies change every 4 to 18 months. Software gurus New method improves anything they said in the past. You need more tools! You need more training! You need more consultancy!

282004/05/21Patterns and AntiPatterns Many Paths to Disaster Structured Programming Artificial Intelligence Networking Technologies Open Systems Parallel Processing

292004/05/21Patterns and AntiPatterns AntiPatterns Negative solutions that present more problems than they address Natural extension to design patterns Bridge the gap between architectural concepts and real-world implementations Provide the knowledge to prevent or recover from them

302004/05/21Patterns and AntiPatterns AntiPattern Research “The presence of ‘good’ patterns in a successful system is not enough; you also must show that those patterns are absent in unsuccessful systems. Likewise, it is useful to show the presence of certain patterns(AntiPatterns) in unsuccessful systems, and their absence in successful systems. “The presence of ‘good’ patterns in a successful system is not enough; you also must show that those patterns are absent in unsuccessful systems. Likewise, it is useful to show the presence of certain patterns(AntiPatterns) in unsuccessful systems, and their absence in successful systems. - James O. Coplien

312004/05/21Patterns and AntiPatterns AntiPattern Research Principal viewpoints Development AntiPatterns Development AntiPatterns Technical problems and solutions encountered by programmers Architectural AntiPatterns Architectural AntiPatterns Identify and resolve common problems in how systems are structured. Managerial AntiPatterns Managerial AntiPatterns Address common problems in software processes and development organizations.

322004/05/21Patterns and AntiPatterns AntiPattern Research

332004/05/21Patterns and AntiPatterns Design Pattern and AntiPattern

342004/05/21Patterns and AntiPatterns Software Refactoring A form of code modification, used to improve the software structure in support of subsequent extension and long-term maintenance. AntiPatterns Define a migration (or refactoring) from negative solutions to positive solutions. Define a migration (or refactoring) from negative solutions to positive solutions. Not only do they point out trouble, but they also tell you how to get out it. Not only do they point out trouble, but they also tell you how to get out it.

352004/05/21Patterns and AntiPatterns The Blob General Form One class monopolizes the processing and other classes primarily encapsulate data. One class monopolizes the processing and other classes primarily encapsulate data. Key Problem The majority of the responsibility are allocated to a single class. The majority of the responsibility are allocated to a single class. Procedural-style rather than object-oriented architectures Procedural-style rather than object-oriented architectures

362004/05/21Patterns and AntiPatterns

372004/05/21Patterns and AntiPatterns

382004/05/21Patterns and AntiPatterns

392004/05/21Patterns and AntiPatterns

402004/05/21Patterns and AntiPatterns

412004/05/21Patterns and AntiPatterns

422004/05/21Patterns and AntiPatterns Summary Structured v.s. Object Oriented Paradigms Patterns help reuse design experiences reuse design experiences Especially in constructing new software understand the full capabilities of object- oriented design understand the full capabilities of object- oriented design communication communication

432004/05/21Patterns and AntiPatterns Summary AntiPatterns not against using patterns. not against using patterns. a more compelling form of patterns. a more compelling form of patterns. Each AnitPattern includes a solution + solution pair. AntiPattern Solution Generates mostly negative consequences. AntiPattern Solution Generates mostly negative consequences. Refactored Solution Generates mostly positive benefits. Refactored Solution Generates mostly positive benefits.

442004/05/21Patterns and AntiPatterns Summary AB Rules What to do What to do What not to do What not to do

452004/05/21Patterns and AntiPatterns References Patterns GoF: E. Gamma, E. Helm, R. Johnson and J. Vlissides, Design Patterns - Elements of Reusable Object-Oriented Software, Addison-Wesley Publishing Company Inc., GoF: E. Gamma, E. Helm, R. Johnson and J. Vlissides, Design Patterns - Elements of Reusable Object-Oriented Software, Addison-Wesley Publishing Company Inc., POSA (Vol. 1): F. Buschmann, R. Meunier, H. Rohnert, P. Sommerlad and M. Stal, Pattern-Oriented Software Architecture – A System of Patterns, John Wiley & Sons Inc., New York, POSA (Vol. 1): F. Buschmann, R. Meunier, H. Rohnert, P. Sommerlad and M. Stal, Pattern-Oriented Software Architecture – A System of Patterns, John Wiley & Sons Inc., New York, POSA (Vol. 2): D. Schmidt, M. Stal, H. Rohnert and F. Buschmann, Pattern- Oriented Software Architecture – Patterns for Concurrent and Networked Objects, John Wiley & Sons Inc., New York, POSA (Vol. 2): D. Schmidt, M. Stal, H. Rohnert and F. Buschmann, Pattern- Oriented Software Architecture – Patterns for Concurrent and Networked Objects, John Wiley & Sons Inc., New York, 2000.

462004/05/21Patterns and AntiPatterns References AntiPatterns W. J. Brown, R. C. Malveau, H. W. McCormick III, T. J. Mowbray, AntiPatterns - Refactoring Software, Architectures, and Projects in Crisis, John Wiley & Sons Inc., New York, W. J. Brown, R. C. Malveau, H. W. McCormick III, T. J. Mowbray, AntiPatterns - Refactoring Software, Architectures, and Projects in Crisis, John Wiley & Sons Inc., New York, Web Sites

472004/05/21Patterns and AntiPatterns Q & A Thank you!