patterns and antipatterns
Download
Skip this Video
Download Presentation
Patterns and AntiPatterns

Loading in 2 Seconds...

play fullscreen
1 / 47

Patterns and AntiPatterns - PowerPoint PPT Presentation


  • 76 Views
  • Uploaded on

Patterns and AntiPatterns. Ku-Yaw Chang [email protected] Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University. Outline. Background Structured v.s. Object-Oriented Paradigm Patterns Command AntiPatterns BLOB Summary References.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Patterns and AntiPatterns' - reed-boyd


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
patterns and antipatterns

Patterns and AntiPatterns

Ku-Yaw Chang

[email protected]

Assistant Professor, Department of Computer Science and Information Engineering

Da-Yeh University

outline
Outline
  • Background
    • Structured v.s. Object-Oriented Paradigm
  • Patterns
    • Command
  • AntiPatterns
    • BLOB
  • Summary
  • References

Patterns and AntiPatterns

background paradigm
BackgroundParadigm
  • A way of organizing system abstractions around properties of commonality and variation.

Patterns and AntiPatterns

background paradigm1
BackgroundParadigm
  • Abstraction
    • To focus on the general and put aside the specific.
    • To emphasize what is common and deemphasize details

Patterns and AntiPatterns

background paradigm2
BackgroundParadigm
  • Commonality
    • The Essence of Abstraction
    • To search for common elements that helps us understand how family members are the same.
  • Variability
    • The Spice of Abstraction
    • Being monotonous without variability.

Patterns and AntiPatterns

background paradigm3
BackgroundParadigm
  • A way of organizing system abstractions around properties of commonality and variation.
    • Commonality
      • The backbone and skeleton of design
    • Variability
      • The flesh and blood

Patterns and AntiPatterns

background paradigm4
BackgroundParadigm
  • Before 1975
    • No specific techniques
  • 1975 – 1985
    • Structured Paradigm
      • Functional Decomposition
  • 1985 – 2004
    • Object-Oriented Paradigm

Patterns and AntiPatterns

structured v s object oriented paradigm
Structured v.s.Object-Oriented Paradigm

message

message

deposit

withdraw

deposit withdraw

account

balance

account

balance

determinebalance

determinebalance

message

Patterns and AntiPatterns

background true object orientation
BackgroundTrue 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.
    • 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.

Patterns and AntiPatterns

patterns
Patterns
  • Having roots in the architecture field by Christopher Alexander

Patterns and AntiPatterns

patterns1
Patterns

Patterns and AntiPatterns

patterns2
Patterns

Patterns and AntiPatterns

patterns3
Patterns
  • Expert behavior
    • do not try to find the solution from first principles
    • reuse the essence of a proven solution to solve the new problem

Patterns and AntiPatterns

patterns4
Patterns
  • Being applied to the software development successfully, especially in the object-oriented community
  • Software reuse
    • Code reuse
    • Design reuse
      • the value of design experience
      • Layers : OSI 7-Layer Model

Patterns and AntiPatterns

what is a pattern
What is a Pattern?
  • Christopher Alexander
    • Each pattern describes a problemwhich 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 1987.
  • Enter the mainstream of OO community in 1994(1st PLoP)

Patterns and AntiPatterns

plop conferences
PLoP Conferences
  • Pattern Languages of Program
    • PLoP
    • Chili PLoP
    • Euro PLoP
    • Koala PLoP
    • Mensore PLoP
    • SugarLoaf PLoP
    • Viking PLoP
    • OOPSLA
    • ECOOP

Allerton Park

Patterns and AntiPatterns

patterns what is a pattern
PatternsWhat is a Pattern?
  • Four Essential Elements
    • pattern name
      • easier to think and to communicate
    • problem
      • explain the problem and its context
      • describe when to apply
    • solution
      • describe the elements
      • their relationships, responsibilities, and collaborations
    • consequence
      • results and trade-offs

Patterns and AntiPatterns

pattern example
Pattern Example
  • Pattern Name
    • Command
  • Pattern Problem
    • different request
    • queue or log request
    • support undoable operations

Patterns and AntiPatterns

pattern example1
Pattern Example
  • Solution (UML)

Patterns and AntiPatterns

pattern example2
Pattern Example
  • Consequences
    • 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.
    • Assemble commands into a composite command.
    • Easy to add new Commands. You don’t have to change existing classes.

Patterns and AntiPatterns

non software pattern example
Non-software Pattern Example
  • Solution

Patterns and AntiPatterns

slide22
Pattern Categories

GoF - 94

  • Creational Patterns
    • Abstract Factory
    • Singleton
  • Structural Patterns
    • Decorator
  • Behavioral Patterns
    • Command

Patterns and AntiPatterns

slide23
Pattern Categories

POSA (Vol. One) - 96

  • Architectural
    • MVC / Doc-View
    • Broker
  • Design
    • Proxy
  • Idioms

Patterns and AntiPatterns

slide24
Pattern Categories

POSA (Vol. Two) - 2000

  • Service Access and Configuration
  • Event Handling
  • Synchronization
  • Concurrency

Patterns and AntiPatterns

slide25
Obsessive use of 1 pattern
  • There are more than 160 fundamental patterns:
    • 23 Gamma Patterns
    • 33 Buschmann Patterns (16+17)
    • 72 Analysis Patterns
    • 38 CORBA Design Patterns
    • ….

Patterns and AntiPatterns

bright and dark sides
Bright and Dark Sides
  • Bright side
    • Reuse of proven good designs
    • Can be applied in constructing new software
  • Dark side
    • Fail to properly evaluate a pattern
    • Difficult to be applied to existing systems

Patterns and AntiPatterns

the truth about software technology
The Truth aboutSoftware 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!

Stone Age !

Patterns and AntiPatterns

slide28
Many Paths to Disaster

Structured Programming

Artificial Intelligence

Networking Technologies

Open Systems

Parallel Processing

Patterns and AntiPatterns

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

Patterns and AntiPatterns

antipattern research
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.

- James O. Coplien

Patterns and AntiPatterns

antipattern research1
AntiPattern Research
  • Principal viewpoints
    • Development AntiPatterns
      • Technical problems and solutions encountered by programmers
    • Architectural AntiPatterns
      • Identify and resolve common problems in how systems are structured.
    • Managerial AntiPatterns
      • Address common problems in software processes and development organizations.

Patterns and AntiPatterns

antipattern research2
AntiPattern Research

Patterns and AntiPatterns

design pattern and antipattern
Design Pattern and AntiPattern

Patterns and AntiPatterns

software refactoring
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.
    • Not only do they point out trouble, but they also tell you how to get out it.

Patterns and AntiPatterns

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

Patterns and AntiPatterns

summary
Summary
  • Structured v.s. Object Oriented Paradigms
  • Patterns help
    • reuse design experiences
      • Especially in constructing new software
    • understand the full capabilities of object-oriented design
    • communication

Patterns and AntiPatterns

summary1
Summary
  • AntiPatterns
    • not against using patterns.
    • a more compelling form of patterns.
  • Each AnitPattern includes a solution + solution pair.
    • AntiPattern Solution Generates mostly negative consequences.
    • Refactored Solution Generates mostly positive benefits.

Patterns and AntiPatterns

summary2
Summary
  • Rules
    • What to do
    • What not to do

A

B

Patterns and AntiPatterns

references
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., 1995.
    • 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, 1996.
    • 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.

Patterns and AntiPatterns

references1
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, 1998.
  • Web Sites
    • http://hillside.net/patterns/
    • http://www.antipatterns.com/

Patterns and AntiPatterns

slide47
Q & A

Thank you!

Patterns and AntiPatterns

ad