The Artima Developer Community
Sponsored Link

Leading-Edge Java
How to Use Design Patterns
A Conversation with Erich Gamma, Part I
by Bill Venners
May 23, 2005

<<  Page 3 of 3


Pattern languages

Bill Venners: What is a pattern language, in the Alexandrian sense?

Erich Gamma: Alexander had a very ambitious goal which was to create architectures that improve the quality of life. To achieve this Alexander developed a pattern language. This is a set of patterns that build on each other. A pattern language guides a designer's application of individual patterns to the entire design. When we started design patterns we were not that ambitious. We used a more bottom-up approach based on micro-architectures.

Bill Venners: What do you mean by bottom up?

Erich Gamma: Let me step back a little and describe how I got into patterns. I think that will answer your question. I was working with Andre Weinand on ET++, a comprehensive class library and framework for C++. As I reflected on ET++, it became apparent that a mature framework contains recurring design structures that give you properties like extensibility, decoupling, and last but not least, elegance. Such structures can be considered micro-architectures that contribute to an overall system architecture. I ended up documenting a dozen or so such micro-architectures in my thesis. This approach to patterns differs from pattern languages: Rather than coming up with a set of interwoven patterns top-down, micro-architectures are more independent patterns that eventually relate to each other bottom-up. A pattern language guides you through the whole design, whereas we have these little pieces, bites of engineering knowledge. I confess that this is less ambitious, but still very important and useful.

Bill Venners: Is a pattern language like having a context free grammar, and from which you can make a whole bunch of programs?

Erich Gamma: There are some similarities at an abstract level. In the same way as a grammar can define a whole bunch of programs a pattern language can generate a bunch of solutions. The way Christopher Alexander describes it is that his patterns describe a solution so that it can be applied many times without ever being the same. But in my opinion at this level the commonality ends.

Bill Venners: By generate, what does he mean? If I have a context free grammar, it doesn't generate the programs. I still have to write them.

Erich Gamma: You still have to make the decisions, but a pattern language provides you more guidance and it has some flow. Say you want to design a room in which you are comfortable. He says, first put lights on two sides. OK, now that you have done lights on two sides, what comes next? How do you place the windows? There are other patterns that describe a solution to this problem. He basically guides you through the space. This kind of connection is what differentiates a library of patterns as we have described in the GoF book from a pattern language. What we have found is that our micro-architectures are also no islands. They are related. We sketched these relationships on the inside of the book cover, and this is what Alexander enthusiasts consider the only valuable part of our book.

Bill Venners: It sounds almost like a design methodology. You go this way, do this, this, and this, and you end up with a beautiful, comfortable to sit in room.

Erich Gamma: Yes, when you follow Alexander's patterns approach you follow the patterns in some sequence. We don't prescribe a particular order. If you have a problem, we have the solution for that, but we don't have the next step. We don't give you hints on what to do next. Alexander is way more thorough in this regard. JUnit has a bit of this pattern language approach, because it can help you write a test case. In the JUnit documentation, Kent and I wrote a mini pattern language on how to implement a test. You start with a test, then you want to factor out common setup code, then you want to group tests together and so on.

Next week

Come back Monday, May 30 for the next installment of this conversation with Erich Gamma. If you'd like to receive a brief weekly email announcing new articles at, please subscribe to the Artima Newsletter.

Talk back!

Have an opinion about the design patterns topics discussed in this article? Discuss this article in the Articles Forum topic, The True Utility of Design Patterns.


Erich Gamma is co-author of Design Patterns: Elements of Reusable Object-Oriented Software, which is available on at:

Erich Gamma is co-creator of JUnit, the defacto standard Java unit testing tool:

Erich Gamma leads the Java development effort for the Eclipse tool platform:

Head First Design Patterns, by Elisabeth Freeman, Eric Freeman, Bert Bates, and Kathy Sierra, is available on at:

You can download a free chapter of Head First Design Patterns from Artima's chapters library:

Contributing to Eclipse: Principles, Patterns, and Plug-Ins, by Erich Gamma and Kent Beck, is available on at:

JUnit: A Cook's Tour, an article by Erich Gamma and Kent Beck, walks you through the design of JUnit by "starting with nothing and applying patterns, one after another, until you have the architecture of the system.":

About the author

Bill Venners is president of Artima Software, Inc. and editor-in-chief of Artima Developer. He is author of the book, Inside the Java Virtual Machine, a programmer-oriented survey of the Java platform's architecture and internals. His popular columns in JavaWorld magazine covered Java internals, object-oriented design, and Jini. Bill has been active in the Jini Community since its inception. He led the Jini Community's ServiceUI project, whose ServiceUI API became the de facto standard way to associate user interfaces to Jini services. Bill also serves as an elected member of the Jini Community's initial Technical Oversight Committee (TOC), and in this role helped to define the governance process for the community.

<<  Page 3 of 3

Sponsored Links

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us