Pattern language
|
A pattern language is a structured method of describing good design practices within a particular domain. It is characterized by
- Noticing and naming the common problems in a field of interest,
- Describing the most 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.
Contents |
Origin
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 A Timeless Way of Building describes what he means by pattern language and how it applies to the design and construction of buildings and towns. 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.
Usage
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 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 UML 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:
- "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" - under what conditions will this solution address this problem?
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
Name: ChocolateChipRatio
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: WalnutRatio or CookingTime or FreezingMethod
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.
Internal link
External links
- The Portland Pattern Repository (http://www.c2.com/)
- Ward Cunningham's Tips For Writing Pattern Languages (http://www.c2.com/cgi/wiki?TipsForWritingPatternLanguages)
- architypes.net - collaborative architecture pattern language project (http://www.architypes.net/patterns.php?show=all)ko:패턴 언어