5. Where did it all
start?
● Christopher Alexander (1936 -)
● Chemistry & Physics, Trinity, Cambridge,
1957
● Ph.D. Architecture, Harvard (1st ever
awarded)
● Professor Architecture, Berkley, 1963
● “Notes on the synthesis of form”, 1964
● First Gold Medal Research, American
Institute of Architects, 1972
● “A Pattern Language”, 1977
6. Alexandrian Form
● Picture – archetypical example
● Introductory paragraph - context
● Headline (in bold) – essence of problem
● Body – background, motivation, variations
● Solution (in bold)
● Diagram (of solution)
● [Smaller] related patterns
7. The Hillside Group
● Promotes patterns in software community
● Formed 1993 by Ward Cunningham,
Ralph Johnson, Ken Auer, Hal
Hildebrand, Grady Booch, Kent Beck and
Jim Coplien
● Cunningham invented Wiki to discuss
patterns
● Sponsors PLoP conferences & books
● Hillside Group: www.hillside.net
● WikiWikiWeb: www.c2.com
8. Canonical [GoF] Form
● Name
● Alias(es) [Also known as]
● Context [Applicability]
● Problem [Intent]
● Forces [Motivation]
● Solution [Participants, Structure,
Collaborations, Implementation]
● Example (optional) [Sample code]
● Resulting context [Consequences]
● Rationale (optional)
● Known uses
● Related patterns
9. Pattern Languages
● Structured method of describing good
design practices within a field of expertise
● A network of patterns that call upon one
another
● Help the designer move from problem to
problem in a logical way
● Allow for many different paths through the
design process
10. Pattern Sequences
● Pattern languages are played out as
sequences
● Sequences show paths through a
language
● Commonly illustrated through stories
● Give rise to common design fragments
● Can be shown diagrammatically, or as a
list
11. And so, back to Singleton
● “Ensure a class has only one instance, and
provide a global point of access to it.” – GoF,
1995
● “[Singleton] invariably causes problems with
coupling and execution, and is more than a
little overused” – Henney, 2005
● “How do you provide global variables in
languages without global variables? Don't.
Your programs will thank you for taking the
time to think about design instead.” – Kent
Beck, 2003
12. An Alternative
You have this system...
● You try globals... well, probably you don't: the one thing you
learned in school was no globals.
● You try for SINGLETON, it is in the book, it is good... but then you
find you have these nasty ripples... then someone tells you it's a
bad thing and it's obvious to you.
● So you try passing parameters: they overwhelm you.
● You refactor a bit (à la Fowler) and before you know it you've got
ENCAPSULATED CONTEXT.
● You carry on down this path, you get more mileage here, but over
time it starts to look like Foote's BIG BALL OF MUD.
The solution is to reduce the coupling, improve the cohesion, but how?
Allan Kelly, 2005
13. Context Encapsulation
Pattern Language
“Context Encapsulation: Three Stories, a Language and Some Sequences”
Kevlin Henney, 2006
http://www.two-sdg.demon.co.uk/curbralan/papers/europlop/ContextEncapsulation.pdf