1 Patterns in Object Oriented Programming A Concise Introductory Presentation Amnon H. Eden Tel Aviv University [email protected]http://www.math.tau.ac.il/~eden Copyrights All Rights Reserved No part of this document may be reproduced or distributed by any means without the prior written permission of the author. Permission is granted for individuals to read and use this document for self study.
60
Embed
1 Patterns in Object Oriented Programming A Concise Introductory Presentation Amnon H. Eden Tel Aviv University [email protected] eden.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Copyrights All Rights ReservedNo part of this document may be reproduced or distributed by any means without the prior written permission of the author. Permission
is granted for individuals to read and use this document for self study.
2
ContentsContents
Prologue: Motivation
1. Historical perspective
2. Terminology and taxonomy
3. Design patterns
4. Summary
Epilogue: Future directions
Appendix: References
3
A ClaimA Claim
Today, design patterns make
the most effective technique
of conducting and training
OOD !
4
Prologue: MotivationPrologue: Motivation
“Software Engineering is an art rather
than science”
“Software Engineering is an art rather
than science”
It requires:
Skill, talent, intelligenceExperience
Creativity, imagination, insight
5
Motivation IIMotivation II
There are about 3000 years of artistic experience to learn from...
…but only some 20 years of experience with OOP! D:Delegator
C1:Concrete_State
Client
F
2: do1(a,b)
1: do1(a,b)
6
Motivation IIIMotivation III
Patterns are about
conveying
skill and experience
7
Part 1: Historical PerspectivePart 1: Historical Perspective
The work of Christopher Alexander Introducing patterns in OOP
– The Hillside group and their work
– A patterns hype
8
Christopher AlexanderChristopher Alexander
An architect
Relate publications: The Timeless Way of
Building (1979) A Pattern Language
(1977)
9
The Work of Christopher AlexanderThe Work of Christopher Alexander
Pattern: “A solution to a problem in a context”.
Pattern language: A set of patterns used to solve closely related problems.
Purpose: – effective reuse– dissemination of solutions
10
Introducing Patterns into OOPIntroducing Patterns into OOP
1987: A workshop in OOPSLA by
Beck & Cunningham
1993: The Hillside Group - Beck,
Cunningham, Coplien, Booch, Johnson, ...
1994: PLoP conference
1995: Design Patterns: Elements of Reusable
Object Oriented Software
11
Part 2: Part 2: TaxonomyTaxonomy
Terms: Pattern Pattern language
Related terms: Design Architecture Framework Library Component
12
Domain Specific PatternsDomain Specific Patterns
Communications and distributed
processing
Operating systems and processes
Business
Reactive systems
MMI-application interaction
13
Language Specific PatternsLanguage Specific Patterns
Also called idioms
C++: Localized Ownership (PLoPD2) Coplien: “Advanced C++ Programming styles
and Idioms”
Smalltalk: Lazy Optimization (PLoPD2) Beck: “Smalltalk Patterns: Best Practices”
14
Dominant Pattern Domains Dominant Pattern Domains
Design patterns !
Architectural Patterns?
15
Presenting a PatternPresenting a Pattern
The common form:
Name
Intent
Solution
Consequences
Other authors:
Name
Problem
[Context]
[Forces]
Solution
16
Part 3: Part 3: Design PatternsDesign Patterns
The Gang of Four
Examples
Definitions
Observations and conventions
Summary
17
TheThe Gang of Four Gang of Four
Erich GammaRichard HelmRalph JohnsonJohn Vlissides
Design Patterns: Elements of Reusable Object Oriented Software (1995).
Part 4: Part 4: Design Patterns - SummaryDesign Patterns - Summary
Perspectives
Observations
Types of design patterns
The Merits of Patterns
42
Perspectives on Patterns IPerspectives on Patterns I
“Each design pattern lets some aspect of system structure vary independently of other aspects, thereby making a system more robust to a particular kind of change.” [GoF 95, p. 24].
For instance:– Observer: the observers vary independently– Strategy: the strategies vary independently– Iterator: the data structures vary independently
43
Perspectives IIPerspectives II
Design patterns are recurring building blocks of rough granularity