You are on page 1of 26

pattern languages

Hugo Sereno Ferreira


Software Engineering Group, FEUP/DEI
FCUP, 25 Mar 2009
The ultimate object of design is form. The
reason that iron filings placed in a magnetic
field exhibit a pattern - have form - is that the
field they are in is not homogeneous...
- Christopher Alexander, 1964
2

3
seminar contents.
The History of Patterns
Patterns and Pattern Languages
Patterns in Software Engineering / Computer Science
Researching
Questions...?
4
christopher alexander.
1936 Austria, B.Sc. architecture, M.Sc. in mathematics.
First Ph.D. in architecture ever awarded at Harvard University.
1st book by author to influence CS: Notes on the Synthesis of Form.
Required reading for researchers in computer science in the '60s.
Recomended by Marvin Minsky, founder of MIT's AI Lab, to his students.
Heavy influence in the 60s & 70s programming language design,
modular programming, object-oriented programming, software
engineering and other design methodologies.
... and all of their books were about civil architecture.
What makes a good design? what is a good solution?
Can we design everything from scratch? by intuition? total control?
Can we measure design? can we afford not to?
Quality without a name (QWAN).
5
design.
jointing
economy
simplicity
performance
-
-
-
-
-
+
There is one timeless way of building. It is a thousand years
old, and the same today as it has ever been. The great
traditional buildings of the past, the villages and tents and
temples in which man feels at home, have always been made
by people who were very close to the center of this way. It is
not possible to make great buildings, or great towns, beautiful
places, places where you feel yourself, places where you feel
alive, except by following this way. And, as you will see, this
way will lead anyone who looks for it to buildings which are
themselves as ancient in their form, as the trees and hills, and
as our faces are.
- Christopher Alexander. The Timeless Way of Building. 1979.
6

7
seminar contents.
The History of Patterns
Patterns and Pattern Languages
Patterns in Software Engineering / Computer Science
Researching
Questions...?
8
definition.
A Pattern is seen in the wild.
A Pattern addresses a recurrent problem.
A Pattern is a recognized good solution...
... and by good we mean balanced within the defined context.
A Pattern is more than a description: its a prescription.
A Pattern catalogue is a set of patterns from the same domain.
A Pattern language defines the relationship between each pattern.
Each pattern is a three-part rule, which expresses a relation
between a certain context, a problem, and a solution.

- Christopher Alexander
9
myths.
A Pattern is not a foundamental building block.
A Pattern is not a recipee.
A Pattern is not a novel idea.
Patterns aren't about Object Oriented design (more later).
Patterns aren't about UML (more later).
A Pattern should evoke an "Ahah!", not an "Uhuh..."
Who is the target audience, then? Practictioners of the Art...
Though, Alexander believed everyone could use a pattern; this was
maybe its single biggest misconception. cf. The Oregon Experience.
10
anti-patterns.
Good solutions are called a pattern.
A recurrent, bad solution, is an anti-pattern.
Why document bad solutions:
Because they are recurrent.
Because it seem obviously good, but is unpredictably bad.
Because it points to a transformation to a better solution.
Some authors in the pattern community argue that a good pattern is a
consequence, or refers to, an anti-pattern (disputed point-of-view).
11
anatomy of a pattern.
Name. Usually a noun catchy phrase
that describes what the pattern builds.
Aliases. Also known as...
Context. Describe the setting for the
problem. Include a description of the
target user.
Forces. Why the problem is not trivial.
Discuss other possible solutions and why
they wont work.
Problem. Unbiased by the solution.
Solution. Include enough detail so the
user can implement the solution, but
dont restrict the pattern to a narrow list
of specifics.
Resulting Context. Include the new
problems that appear as a result of
applying the pattern that will require
new patterns for their resolution.
Rationale. Explain the rationale behind
the solution. Convince the reader. Tell
stories! Share your expertise.
Known Uses. Briefly list or describe
places where the pattern is used.
Related Patterns. Briefly describe any
related patterns and their relationships
to this pattern.
Sketch. If appropriate.
Example.
In nature, its not the strongest nor the most
intelligent who survives. Its the most
adaptable to change.
- Charles Darwin, 1809 - 1882
12

Patterns tend to be good solutions because they have been


subject to natural selection, to daily usage; not a synthesis
of design, but a product of function.
- Myself, today
13
seminar contents.
The History of Patterns
Patterns and Pattern Languages
Patterns in Software Engineering / Computer Science
Researching
Questions...?
14
software quality.
In software, the process of design is influenced by a set of forces
known as quality attributes.
A particular solution is a balance between relevant forces.
How can we quantify those forces?
Which can be measured/asserted during the design phase?
What about qualitative forces?
What about QWAN?
Is software development a pure scientific activity? Can we afford
not to?
Knuth, Donald. The Art of Computer Programming.
15
software quality attributes.
accessibility
accountability
accuracy
adaptability
administrability
affordability
agility
auditability
availability
credibility
standards compliance
process capabilities
compatibility
composability
configurability
correctness
customizability
degradability
demonstrability
dependability
deployability
distributability
durability
evolvability
extensibility
fidelity
flexibility
installability
integrity
interchangeability
interoperability
learnability
maintainability
manageability
mobility
modularity
nomadicity
operability
portability
precision
predictability
recoverability
relevance
reliability
repeatability
reproducibility
responsiveness
reusability
robustness
safety
scalability
seamlessness
serviceability (a.k.a.
supportability)
securability
simplicity
stability
survivability
sustainability
tailorability
testability
timeliness
understandability
usability
16
software design patterns.
Gamma et al. Design Patterns: Elements of Reusable Object-Oriented
Software. 1994.
It presents 23 patterns, divided into 3 categories, all of them
interconnected.
Its taught in CS/SE courses in the whole world as an introductory
book on software architecture and design patterns.
But several people are missing the point:
Patterns have a context. That context may need to be adapted.
Patterns should never be used out of the box.
Singleton,
Composite,
Faade,
Abstract Factory,
Proxy,
State,
Bridge,
Factory method,
Decorator,
Adapter,
Flyweight,
...
17
software architectural patterns.
Bucshmann et al. series of Pattern Oriented Software Architecture
go one level up of abstraction (architecture > design) and is more
decoupled from OO than the GoF book (different domain).
Some examples are:
Layers,
Pipes and Filters,
Blackboard,
Broker,
Model-View-Controller,
Presentation-Abstraction-Control,
Microkernel,
Reflection,
Whole-part,
Master-slave,
Proxy,
Command Processor,
View Handler,
...
18
domain-specific patterns.
There are several books and pattern languages that focus on specific
domains such as:
Distributed systems,
Adaptive systems,
Requirements engineering,
Sociology,
Psychology,
Documentation,
Frameworks,
Interaction design,
Pedagogical,
...
Some are even about patterns themselves:
A Pattern Language for Patern Writing,
A Pattern Language for Shepherds and Sheep,
Meta Patterns,
...
19
functional languages.
If you are a FP proponent, and are still wondering if they make
sense in that domain...
Always remember:
A Pattern is NOT the implementation.
There are forces which are not quantitative, thus cannot be
parameterized.
Each pattern is defined within a particular domain: it may be
pointless to transpose it into a similar domain.
1. Eugene Wallingford. Functional Programming Patterns and Their Role in Instruction.
http://www.cs.uni.edu/~wallingf/patterns/papers/fdpe2002/fdpe2002-long.pdf
2. Sergio Antoy. A Catalog of Design Patterns in FLP. http://web.cecs.pdx.edu/~antoy/
flp/patterns/
20
seminar contents.
The History of Patterns
Patterns and Pattern Languages
Patterns in Software Engineering / Computer Science
Researching
Questions...?
21
se/cs research methodologies.
Scientific method. Scientists develop a theory to explain a
phenomenon; they propose an hypothesis and then test alternative
variations of the hypothesis. As they do so, they collect data to verify
or refute the claims of the hypothesis.
Engineering method. Engineers develop and test a solution to an
hypothesis. Based upon the results of the test, they improve the
solution until it requires no further improvement.
Empirical method. A statistical method is proposed as a means to
validate a given hypothesis. Unlike the scientific method, there may
not be a formal model or theory describing the hypothesis. Data is
collected to verify the hypothesis.
Analytical method. A formal theory is developed, and results derived
from that theory can be compared with empirical observations.
i
n

T
i
c
h
y

e
t

a
l
.

9
3
,

Z
e
l
k
o
w
i
t
z

e
t

a
l
.

9
8
22
pattern mining.
(a) Pick a whole area, not just one idea.
(b) Make a list of all the little things you have learned through the years
about the area.
(c) Cast each item on your list as a solution.
(d) Now write each item as a pattern.
(e) Organize your patterns into sections.
(f) Now write an introduction to your pattern language that hints at the
forces you will be addressing.
(g) Pick a good name too.
i
n

W
a
r
d

C
u
n
n
i
n
g
h
a
m

1
9
9
4
23
plop and writers workshop.
Pattern Languages of Programs Conference (16th @ 2009)
Multi-stage, peer-reviewed conference, based on:
Shepherding. The shepherd (a reviewer) interact (3x) with the
authors in order to provide improvements and guidance.
Expert Reviewer. The final decision after the phase of shepherding is
done by the shepherd and an expert reviwer in the precise area.
Writer's Workshop. Inspired in the XIX century literary groups.
Final publication. Published by ACM. Selected patterns goes to LNCS.
Author retains ALL copyright over his work, even after publication!
24
Resources
25
references.
1. Christopher Alexander. Notes on the Synthesis of Form. Harvard University Press, 1964.
2. Christopher Alexander. A Pattern Language: Towns, Buildings, Construction. Oxford University Press,
1977.
3. Christopher Alexander. The Timeless Way of Building. Oxford University Press, 1979.
4. Kent and Cunningham. Using Pattern Languages for Object-Oriented Program. OOPSLA workshop on
Specification and Design for Object-Oriented Programming, 1987.
5. Gamma et al. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley
Professional, 1994.
6. Buschmann et al. Pattern Oriented Software Architecture, Volumes 1-5. Wiley, 1996 - 2007.
7. Brown et al. AntiPatterns: Refactoring Software, Architectures, and Projects in Crisis. Wiley, 1998.
8. Richard P. Gabriel. Writers Workshops As Scientific Methodology. http://www.dreamsongs.com/Files/
WritersWorkshops.pdf
9. Meszaros and Doble. A Pattern Language for Pattern Writing. http://www.hillside.net/patterns/writing/
patternwritingpaper.htm
10. Harrison, Neil. A Pattern Language for Shepherds and Sheep. http://homepages.mcs.vuw.ac.nz/~kplop/
Shp.html
11. Wolfgang Pree. A Means For Capturing the Essentials of Reusable Object-Oriented Design.
12. The Hillside Group. http://www.hillside.net/
26
seminar contents.
The History of Patterns
Patterns and Pattern Languages
Patterns in Software Engineering / Computer Science
Researching
Questions...?

You might also like