A pattern language is the use of patterns to convey meaning. Patterns can be conveyed through any sense, such as sight, sound, touch, taste, and smell. An example of a sight-based pattern language is the written language, which uses symbols to convey complex messages.
It is characterized by:
- Noticing and naming the common problems in a field of interest,
- Describing the key characteristics of effective solutions for meeting some stated goal,
- Helping the designer move from problem to problem in a logical way, and
- Allowing for many different paths through the design process.
Pattern languages are used to formalize decision-making values whose effectiveness becomes obvious with experience but that are difficult to document and pass on to novices. They are also effective tools in structuring knowledge and understanding of fundamentally complex systems without forcing oversimplification.
Christopher Alexander coined the term pattern language. He used it to refer to common problems of civil and architectural design, from how cities should be laid out to where windows should be placed in a room. The idea was initially popularized in his book A Pattern Language.
Alexander's book The Timeless Way of Building describes what he means by pattern language and how it applies to the design and construction of buildings and communities. However, the system is equally applicable to any field of design.
What is a pattern?
A common problem (or decision) in a design process, together with its best solution, is a single design pattern. Each pattern has a name, a descriptive entry, and some cross-references, much like a dictionary entry.
Many patterns form a language
Just as words must have grammatical and semantic relationships to each other in order to make a spoken language useful, design patterns must be related to each other in order to form a pattern language. Implicit in Alexander's work is the idea that the patterns should be organized into a logical or naturally intuitive structure. The actual structure (hierarchical, iterative, etc.) may vary, depending on the topic. Each pattern should indicate its relationship to other patterns and to the language as a whole.
Alexander encouraged people who used his system to expand his language with patterns of their own. In order to enable this, his books do not focus strictly on architecture or civil engineering; he also explains the general method of pattern languages. Consequently, his methods have been used to document expertise in diverse fields, such as computer science patterns used in software engineering, interaction design patterns in human computer interaction and pedagogical patterns in education. However, Alexander's specifications for using pattern languages as well as creating new ones remain authoritative, and his books are referenced for style by experts in unrelated fields.
It is important to note that notations such as Unified Modeling Language or the flowchart symbol collection are not pattern languages (although they could possibly be used to express a pattern language). A recipe or other sequential set of steps to be followed, with only one correct path from start to finish, is also not a pattern language. However, the process of designing a new recipe might benefit from the use of a pattern language.
How to document a single pattern
According to Alexander, a single pattern should be described in three parts:
- "context" - under what conditions will this solution address this problem?
- "system of forces" - in many ways it is natural to think of this as the "problem" or "goal"
- "solution" - a configuration that brings the forces into balance or solves the problems presented
Context -> System of forces -> Configuration
Therefore, a single entry in a pattern language should have a simple name, a concise description of the problem, a clear solution, and enough information to help the reader understand when this solution is the most appropriate one. It should also note which patterns must be considered beforehand, and which patterns it is natural to consider next.
Simple example of a pattern
Context: You are baking chocolate chip cookies in small batches for family and friends
Consider these patterns first: SugarRatio, FlourRatio, EggRatio
Problem: Determine the optimum ratio of chocolate chips to cookie dough
Solution: Observe that most people consider chocolate to be the best part of the chocolate chip cookie. Also observe that too much chocolate may prevent the cookie from holding together, decreasing its appeal. Since you are cooking in small batches, cost is not a consideration. Therefore, use the maximum amount of chocolate chips that results in a sturdy cookie.
Consider next: NutRatio or CookingTime or FreezingMethod
Pattern language in architecture
Example from Alexander's book A Pattern Language
- "Arcades - covered walkways at the edge of buildings, which are partly inside, partly outside-play a vital role in the way that people interact with buildings"
- Followed by a description of the pattern and cross-reference to smaller component patterns (columns, roof, ceiling height) and larger patterns that form a context for this element (connections between buildings, etc.).
Pattern language and wikis
Ward Cunningham created the original Wiki, the Portland Pattern Repository, as a way to express pattern languages effectively; it now contains hundreds of patterns for a variety of things, including many for extreme programming.
Tips for making a pattern language
The following steps assume the use of a hypertext computer application such as a wiki.
- Think about your situation as a rough hierarchy of ideas, like a fractal, from the big picture to the details.
- Put each idea on a different page, named with a title that describes the idea in a few words.
- On an index page, order the ideas from large-scale to details. This allows the entire pattern language to be linearized and printed out, if necessary. It also vastly increases the usability of the system if (almost) all the pages are mentioned in a big list.
- For each pattern, write a description of the problem, the solution, and an example. While writing, link to the patterns that relate in the less- and more-specific directions.
- Graphics are helpful.
- If there are multiple people editing a pattern language, sign your work. Apart from the obvious reason, this allows you to quickly get a list of your pages using a reciprocal link on every page.
- Give references where appropriate.
- Put a link back to the index page at the bottom of each pattern.
- You will probably need one window open for writing your page, and at least one more to jump back and forth between references.