Industrial Logic -> Papers -> A Learning Guide To Design Patterns

A Learning Guide To Design Patterns

Version: 1.7
Author: Joshua Kerievsky, Industrial Logic, Inc.
Started: November, 1997
Updated: February, 2000


Every now and then I ask people if they are familiar with the book, Design Patterns: Elements of Reusable Object-Oriented Software. On such occassions, I'm often surprised to hear someone respond, "Yes, I've read it." Having spent close to three years running a study group devoted to understanding the subtleties, combinations and variations of the patterns in this book and others, I am often compelled to ask these individuals if they actually believe that the book can be "read" rather than "studied"?

This learning guide has been written for those who want to learn and use design patterns, rather than just read about them.

The guide is composed of three sections:

  Industrial Logic, Inc.


What Is A Study Group?

Over the course of my school days and professional years I've come to recognize and appreciate the study group as one of the best instruments for improving one's understanding of anything complex or profound.

The summer before my first year of college, I was required to read Homer's Illiad for a freshman seminar. I was hiking that summer and would read Homer by flashlight before I went to bed each night. When I had finally finished the epic tale of Achilles, I remember that I was not all that impressed: I essentially considered the book to be a war novel.

When school started, I attended my first seminar on a warm evening in August . The seminar room had high ceilings and many windows and contained a long wooden table, surrounded by wooden chairs, with a chair at either end of the table for the two "tutors". One tutor was charged with asking the opening question.

This question took several minutes to ask, but when the tutor had finished, I knew that I had only touched the surface of the Iliad.

The opening question pointed to a more profound and sophisticated level of meaning and over the course of that evening, our group endeavored to answer that opening question. In searching for an answer, we questioned our original ideas, questioned the ideas of our peers, and ultimately worked to understand the Illiad on a deeper level. By the end of the two-hour seminar that evening, we learned far more than we had in our individual readings.

Definition of a Study Group

What I call a "study group" is inspired by the classical method of seminars conducted at schools like Oxford and St John's College.

A study group is a collection of individuals who gather together regularly to improve their understanding of some non-trivial subject, such as a body of great literature, by participating in a focused discussion.

Individuals meet around a table or in a circle for 1 to 2 hours, and group size varies from 3 to as many as 16 inidividuals. Group size is limited by space or table size and whether folks can see and hear one another during discussion.

The study group organizes and maintains an agenda of readings. Prior to each meeting, participants have read and reflected upon the reading and may come prepared with questions, ideas about, or explanations of the reading.

One individual, who is sometimes called the "moderator," asks the opening question at the commencement of each meeting. This individual is charged with guiding the dialogue during the rest of the meeting, but this individual is not a teacher. He or she is simply considered to be the most advanced student with respect to a reading. If an individual is more advanced than others in the group, it makes sense for that individual to perform the role of moderator for several meetings until others feel comfortable in that role. Should a debate get out of hand or a dialogue stray or lag, the moderator will help refocus the discussion, often asking if the opening question has been answered or stepping in to make sure that statements are properly validated. Some further thoughts on opening questions and sample opening questions may be found below.

Study groups work best in quiet, aesthetic places that invite reflection: a centrally located cafe, a room with a magnificient view, or some nook or corner of a hotel or lodge.

The Design Patterns Study Group of NYC has found that an architectually rich environment is well suited to the study of design patterns. The group has declined numerous invitations to use uniformly illuminated corporate locations, but has instead continued to congregate at a spacious and soothing SoHo gallery/espresso bar that exemplifies Christopher Alexander's Sitting Circle (185), Different Chairs (251) and Pools Of Light (252) patterns (see Alexander's A Pattern Language).

Study Groups vs. Lectures

It is important to note the differences between study groups and lectures, since the vast majority of software groups (SIGs - Special Interest Groups) currently use the lecture format. This paper argues that the study group is a superior forum for learning.

A study group, as we've defined it above, is quite different in form and purpose from a lecture. While there is nothing wrong with lectures, they have a tendency to create passive learning experiences for attendees. If one is interested in simply gathering information, a lecture may be a fine place to do it. But if one really wants to understand something (to "get your hands dirty"), there is nothing like a study group.

While attendees of a lecture may seek information, attendees of a study group seek transformation; they want to make what they study not only something they understand, but something they may use in their everyday lives or work. The study group thus acts as a bridge, helping people move from passive to active learning.

While "experts" are often asked to give lectures, study groups prefer to invite experts to participate in a group, to ask opening questions and be an active member in a dialogue. The focus here is always on great literature, be it an important paper, article, or book. The group's dialogue revolves around getting to a better understanding of the issues.

Nuts & Bolts

If you are interested in creating your own Design Patterns Study Group, the following two sections on Navigation and Opening Questions offer concrete advice about how to go about doing it.

The Navigation section offers a path through the book's 23 patterns, and is designed to help a group stay focused and move intelligently from pattern to related pattern.

The suggested Opening Questions will help a group moderator consider what to ask at the commencement of a meeting.

Finally, it is important to note that what is being offered here is merely a beginning. The patterns literature is large. When groups within the Design Patterns Study Group finish their study of the Design Patterns book, they go on to study many excellent papers, articles, and books , covering object-oriented patterns, non-object-oriented patterns, concurrent, architectual, and analysis patterns, communications and organizational patterns, and many more. In a future work, I will present a suggested navigation along with opening questions for the broader range of patterns and pattern languages that are regularly read and discussed by the Design Patterns Study Group of NYC.

Meeting Spaces
The following pattern excepts from Christopher Alexander's book, A Pattern Language, offer insight into the nature of good meeting spaces for study groups:

Sitting Circle (185)
...A group of chairs, a sofa and a chair, a pile of cushions -- these are the most obvious things in everybody's life -- and yet to make them work, so people become animated and alive in them, is a very suble business. Most seating arrangements are sterile, people avoid them, nothing ever happens there. Others seem somehow to gather life aroud them, to concentrate and liberate energy. What is the difference between the two?


Place each sitting space in a position which is protected, not cut by paths or movements, roughly circular, made so that the room itself helps suggest the circle -- not too strongly -- with paths and activities around it, so that people naturally gravitate toward the chairs when they get into the mood to sit. Place the chairs and cusions loosely in the circle, and have a few too many.

Pools Of Light (252)
...Uniform illumination --the sweetheart of the lighting engineers-- serves no useful purpose whatsoever. In fact, it destroys the social nature of space, and makes people feel disoriented and unbounded.


Place the lights low, and apart, to form individual pools of light which encompass chairs and tables like bubbles to reinforce the social character of the spaces which they form. Remember that you can't have pools of light without the darker places in between.

Different Chairs (251)
...People are different sizes; they sit in differnt ways. And yet there is a tendency in modern times to make all chairs alike.


Never furnish any place with chairs that are identically the same. Choose a variety of differnt chairs, some big, some small, some softer than others, some rockers, some very old, some new, with arms, without arms, some wicker, some wook, some cloth.

Patterns Study & Discussion Groups
Groups that meet regularly and discuss patterns are located all over the world. Visit the following web sites to learn more about each group or consider starting one of your own if a group is not in your area.

Sydney Patterns Discussion Group

Design Patterns Study Group of NYC

UIUC Patterns Discussion Group

Peanut Butter Club located in Corvallis, Oregon

Washington Object Architecture & Design Club

Phoenix Patterns Group

NADA Design Pattern Discussion Group, located in Stockholm, Sweden.

Patterns Reading Group, Israel

Calgary Patterns User Group

North Texas Patterns Discussion Group

Chicago Patterns Group

San Francisco Patterns Group

Triangle Pattern Languages User Group, located in North Carolina

Suggested Navigation

When one begins to study the patterns in the Design Patterns book, it soon becomes apparent that there is no predetermined way to navigate the 23 patterns. The book's patterns are broken up into Creational, Structural and Behavioral categories. These categories help one quickly find different types of patterns, but aren't particularly helpful in giving people an idea of where to begin studying and how to proceed from pattern to pattern.

Patterns in general are seldom used in isolation. The Iterator pattern is often used with the Composite pattern, the Observer and Mediator patterns form a classic bond, Singleton is used with Abstract Factory, and so on. When you begin to design and program with patterns, you soon discover that the real art in using patterns is knowing how to combine them.

The authors of the Design Patterns book suggest the connections between patterns, but do not offer a navigation through them. Many of the patterns show up all over the book, so it helps to learn some before others. And some patterns are quite a bit more complex than others.

Over a number of years now, the DPSG has had several groups study the patterns over a 23 week period. Each group has experimented with, discussed, and modified the navigation to make it work for them. Over time, one suggested navigation has emerged that is now used by every new group that studies the book. This suggested navigation is designed to help novices move intelligently from pattern to pattern with the goal of mastering all 23 patterns. Please note that this suggested navigation continues to be improved, and your suggested improvements are welcome: please email suggestions to

Further Navigation
Ward Cunningham hosts the WikiWeb, which is perhaps the best place to discover or contribute to a growing body of valuable pattern-oriented ideas (such as the HistoryOfPatterns).

For those who are completely new to patterns, Brad Appleton has written a wonderful paper called Patterns and Software: Essential Concepts and Terminology

For those who would like to learn the Design Patterns in an intensive class, Industrial Logic offers The Design Patterns Workshop

Design Patterns Navigation

l Factory Method Session 1
Begin with Factory Method. This pattern is used by a number of patterns in the book and throughout the patterns literature.
u Strategy Session 2
Strategy is used frequently throughout the book, and an early knowledge of it helps in understanding other patterns.
n Decorator Session 3
For an early dose of elegance, nothing is better than the Decorator. The discussion of "skin" vs. "guts" is a great way to differentiate Decorator from the previous pattern, Strategy.
n Composite Session 4
The Composite pattern appears everywhere and is often used with Iterator, Chain of Responsibility, Interpreter, and Visitor patterns.
u Iterator Session 5
Reenforce the reader's understanding of Composite by studying Iterator.
u Template Method Session 6
The author's footnote to Iterator explains that a method called "Traverse" in the Iterator example code is an example of a Template Method. This pattern also reenforces Strategy and Factory Method.
l Abstract Factory Session 7
The reader now returns to the second-easiest creational pattern, the Abstract Factory. This pattern also helps reenforce Factory Method.
l Builder Session 8
The reader now may compare another creational pattern, the Builder, with the Abstract Factory.
l Singleton Session 9
Singleton is often used to model Abstract Factories, as the "Related Patterns" section of Singleton describes.
n Proxy Session 10
The reader now has a chance to learn how Proxy is used to control access to an object. This pattern leads directly into the next pattern, Adapter.
n Adapter Session 11
The Adapter pattern may be compared with what the reader understands about Decorator, Proxy, and later, Bridge.
n Bridge Session 12
Finally, the reader learns how the Bridge pattern differs from both the Adapter and Proxy patterns.
u Mediator Session 13
Now the reader learns the Mediator pattern, in preparation for understanding Observer and the Model-View-Controller design.
u Observer Session 14
Discover how the Mediator is used by the Observer to implement the classic Model-View-Controller design.
u Chain of Responsibility Session 15
After exploring how messages are passed using the Observer and Mediator patterns, the reader now may contrast how messages are handled by the Chain of Responsibility pattern.
u Memento Session 16
The reader now moves on to Memento. This pattern leads directly into a discussion of undo and redo, which is related to the next pattern, Command.
u Command Session 17
The Command pattern is used in a number of ways, one of which relates to the previous pattern, Mediator.
l Prototype Session 18
Perhaps the most complex creational pattern, Prototype is often used with the Command pattern.
u State Session 19
The reader may now study State to understand another way an object's behavior changes.
u Visitor Session 20
Visitor is often combined with the Composite and/or Iterator patterns.
n Flyweight Session 21
The Flyweight pattern is one of the more complex patterns. An examples use of this pattern is described in the next pattern, Interpreter.
u Interpreter Session 22
The Interpreter pattern is complex. It makes reference to and helps reenforce one's understanding of Flyweight and Visitor.
n Facade Session 23
The final pattern to read is Facade. Facade is relatively straightforward and follows nicely after Interpreter since the example code is similar in theme to example code in the Interpreter.

l Creational
n Structural
u Behavioral

Opening Questions

Opening questions are extremely important to study groups.
The best opening questions are designed to engage the minds of group participants, to get groups thinking on a deeper level, and to promote active learning.

Opening questions sometimes make groups rethink what they thought they understood. And that is usually the sign of a great opening question.

Opening questions may uncover nuances in meaning, reveal contradictions or even errors, or highlight possible ramifications of an expressed idea.

Opening questions may contrast what has been said with what someone else has to say on a similar subject.

The Moderator's Responsibility

A moderator must formulate and ask an opening question or questions. A moderator must also ensure that others have listened to and understand their question, even if it involves rephrasing the question or offering an example to help illustrate it.

But it is not always necessary for a moderator to be an "expert" on the selected writing for a group session. While it certainly helps to be an expert, there is nothing wrong with having a partial understanding of a writing and asking sincere questions in order to gain a better understanding of that piece of writing.

At the end of a session, moderators often ask if their question was sufficiently answered. When a question has not been answered, moderators sometimes ask their question at a later meeting on a similar topic. Or, to check the validity of an answer (or answers) to an opening question, moderators sometimes seek out the author(s) of a writing to ask them if their group got it right (i.e. came to a correct conclusion).

The opening questions provided below are suggested questions and are by no means a complete list. Feedback is welcome and encouraged (please email

Professor Alder Mortimer Adler , the famous professor from the University of Chicago who edited the Great Books of the Western World series and wrote the book How To Read A Book, has been conducting seminars for well over half a century. In an essay entitled: Seminars: Teaching and Learning by Discussion, Adler had this to say about the nature of a good opening question:

...They should be questions that raise issues; questions that raise further questions when first answers are given to them; questions that can seldom be answered simply by Yes or No; hypothetical questions that present suppositions the implications or consequences of which are to be examined; questions that are complex and have many related parts, to be taken up in an orderly manner.

Opening Questions For A Study Group

l Factory Method Session 1
How does Factory Method promote loosely coupled code?
u Strategy Session 2
Part 1: What happens when a system has an explosion of Strategy objects? Is there some way to better manage these strategies?

Part 2: In the implementation section of this pattern, the authors describe two ways in which a strategy can get the information it needs to do its job. One way describes how a strategy object could get passed a reference to the context object, thereby giving it access to context data. But is it possible that the data required by the strategy will not be available from the context's interface? How could you remedy this potential problem?

n Decorator Session 3
In the Implementation section of the Decorator Pattern, the authors write: A decorator object's interface must conform to the interface of the component it decorates.

Now consider an object A, that is decorated with an object B. Since object B "decorates" object A, object B shares an interface with object A. If some client is then passed an instance of this decorated object, and that method attempts to call a method in B that is not part of A's interface, does this mean that the object is no longer a Decorator, in the strict sense of the pattern? Furthermore, why is it important that a decorator object's interface conforms to the interface of the component. it decorates?

n Composite Session 4
Part 1: How does the Composite pattern help to consolidate system-wide conditional logic?

Part 2: Would you use the composite pattern if you did not have a part-whole hierarchy? In other words, if only a few objects have children and almost everything else in your collection is a leaf (a leaf can have no children), would you still use the composite pattern to model these objects?

u Iterator Session 5
Consider a composite that contains loan objects. The loan object interface contains a method called "AmountOfLoan()", which returns the current market value of a loan. Given a requirement to extract all loans above, below or in between a certain amount, would you write or use an Iterator to do this?
u Template Method Session 6
The Template Method relies on inheritance. Would it be possible to get the same functionality of a Template Method, using object composition? What would some of the tradeoffs be?
l Abstract Factory Session 7
In the Implementation section of this pattern, the authors discuss the idea of defining extensible factories. Since an Abstract Factory is composed of Factory Methods, and each Factory Method has only one signature, does this mean that the Factory Method can only create an object in one way?

Consider the MazeFactory example. The MazeFactory contains a method called MakeRoom, which takes as a parameter one integer, representing a room number. What happens if you would also like to specify the room's color & size? Would this mean that you would need to create a new Factory Method for your MazeFactory, allowing you to pass in room number, color and size to a second MakeRoom method?

Ofcourse, nothing would prevent you from setting the color and size of the Room object after is has been instantiated, but this could also clutter your code, especially if you are creating and configuring many objects. How could you retain the MazeFactory and keep only one MakeRoom method but also accomodate different numbers of parameters used by MakeRoom to both create and configure Room objects?

l Builder Session 8
Like the Abstract Factory pattern, the Builder pattern requires that you define an interface, which will be used by clients to create complex objects in pieces. In the MazeBuilder example, there are BuildMaze(), BuildRoom() and BuildDoor() methods, along with a GetMaze() method. How does the Builder pattern allow one to add new methods to the Builder's interface, without having to change each and every sub-class of the Builder?
l Singleton Session 9
The Singleton pattern is often paired with the Abstract Factory pattern. What other creational or non-creational patterns would you use with the Singleton pattern?
n Proxy Session 10
If a Proxy is used to instantiate an object only when it is absolutely needed, does the Proxy simplify code?
n Adapter Session 11
Would you ever create an Adapter that has the same interface as the object which it adapts? Would your Adapter then be a Proxy?
n Bridge Session 12
How does a Bridge differ from a Strategy and a Strategy's Context?
u Mediator Session 13
Since a Mediator becomes a repository for logic, can the code that implements this logic begin to get overly complex, possible resembling speggheti code? How could this potential problem be solved?
u Observer Session 14
Part 1: The classic Model-View-Controller design is explained in Implementation note #8: Encapsulating complex update semantics. Would it ever make sense for an Observer (or View) to talk directly to the Subject (or Model)?

Part 2: What are the properties of a system that uses the Objserver pattern extensively? How would you approach the task of debugging code in such a system?

Part 3: Is it clear to you how you would handle concurrency problems with is pattern? Consider an Unregister() message being sent to a subject, just before the subject sends a Notify() message to the ChangeManager (or Controller).

u Chain of Responsibility Session 15
Part 1: How does the Chain of Responsibility pattern differ from the Decorator pattern or from a linked list?.

Part 2: Is it helpful to look at patterns from a structural perspective? In other words, if you see how a set of patterns are the same in terms of how they are programmed, does that help you to understand when to apply them to a design?

u Memento Session 16
The authors write that the "Caretaker" participant never operates on or examines the contents of a memento. Can you consider a case where a Caretaker would infact need to know the identity of a memento and thus need the ability to examine or query the contents of that memento? Would this break something in the pattern?
u Command Session 17
In the Motivation section of the Command pattern, an application's menu system is described. An application has a Menu, which in turn has MenuItems, which in turn execute commands when they are clicked. What happens if the command needs some information about the application in order to do its job? How would the command have access to such information such that new comamnds could easily be written that would also have access to the information they need?
l Prototype Session 18
Part 1: When should this creational pattern be used over the other creational patterns?

Part 2: Explain the difference between deep vs. shallow copy.

u State Session 19
If something has only two to three states, is it overkill to use the State pattern?
u Visitor Session 20
One issue with the Visitor pattern involves cyclicality. When you add a new Visitor, you must make changes to existing code. How would you work around this possible problem?
n Flyweight Session 21
Part 1: What is a non-GUI example of a flyweight?

Part 2: What is the minimum configuration for using flyweight? Do you need to be working with thousands of objects, hundreds, tens?

u Interpreter Session 22
As the note says in Known Uses, Interpreter is most often used "in compilers implemented in object-oriented languages...". What are other uses of Interpreter and how do they differ from simply reading in a stream of data and creating some structure to represent that data?
n Facade Session 23
Part 1: How complex must a sub-system be in order to justify using a facade?

Part 2: What are the additional uses of a facade with respect to an organization of designers and developers with varying abilities? What are the political ramifications?

l Creational
n Structural
u Behavioral

FacebookFacebook  TwitterTwitter  linked inLinkedIn