You are on page 1of 26

pattern languages

FCUP, 25 Mar 2009

Hugo Sereno Ferreira


Software Engineering Group, FEUP/DEI

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

seminar contents.
The History of Patterns
Patterns and Pattern Languages
Patterns in Software Engineering / Computer Science
Researching

Questions...?

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.
4

design.
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?
performance
-

simplicity
+

jointing
-

economy

Quality without a name (QWAN).


5

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.

seminar contents.
The History of Patterns
Patterns and Pattern Languages
Patterns in Software Engineering / Computer Science
Researching

Questions...?

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
8

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.
9

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).

10

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.

11

In nature, its not the strongest nor the most


intelligent who survives. Its the most
adaptable to change.
- Charles Darwin, 1809 - 1882

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
12

seminar contents.
The History of Patterns
Patterns and Pattern Languages
Patterns in Software Engineering / Computer Science
Researching

Questions...?

13

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.
14

software quality attributes.


accessibility

customizability

maintainability

robustness

accountability

degradability

manageability

safety

accuracy

demonstrability

mobility

scalability

adaptability

dependability

modularity

seamlessness

administrability

deployability

nomadicity

affordability

distributability

operability

serviceability (a.k.a.
supportability)

agility

durability

portability

securability

auditability

evolvability

precision

simplicity

availability

extensibility

predictability

stability

credibility

fidelity

recoverability

survivability

standards compliance

flexibility

relevance

sustainability

process capabilities

installability

reliability

tailorability

compatibility

integrity

repeatability

testability

composability

interchangeability

reproducibility

timeliness

configurability

interoperability

responsiveness

understandability

correctness

learnability

reusability

usability
15

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,

Proxy,

Decorator,

Composite,

State,

Adapter,

Faade,

Bridge,

Flyweight,

Abstract Factory,

Factory method,

...
16

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,

Reflection,

Pipes and Filters,

Whole-part,

Blackboard,

Master-slave,

Broker,

Proxy,

Model-View-Controller,

Command Processor,

Presentation-Abstraction-Control,

View Handler,

Microkernel,

...

17

domain-specific patterns.
There are several books and pattern languages that focus on specific
domains such as:
Distributed systems,

Documentation,

Adaptive systems,

Frameworks,

Requirements engineering,

Interaction design,

Sociology,

Pedagogical,

Psychology,

...

Some are even about patterns themselves:


A Pattern Language for Patern Writing,
A Pattern Language for Shepherds and Sheep,
Meta Patterns,
...
18

functional languages.
If you are a FP proponent, and are still wondering if they make
sense in that 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/

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.
19

seminar contents.
The History of Patterns
Patterns and Pattern Languages
Patterns in Software Engineering / Computer Science
Researching

Questions...?

20

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.

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.

in Tichy et al. 93, Zelkowitz et al. 98

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.

21

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.
(f) Now write an introduction to your pattern language that hints at the
forces you will be addressing.
(g) Pick a good name too.

in Ward Cunningham 1994

(e) Organize your patterns into sections.

22

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!
23

Resources

24

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/

25

seminar contents.
The History of Patterns
Patterns and Pattern Languages
Patterns in Software Engineering / Computer Science
Researching

Questions...?

26

You might also like