Published on ONJava.com (http://www.onjava.com/)
 See this if you're having trouble printing code examples

Form Your Own Design Pattern Study Group

by Elisabeth Robson, Eric Freeman, coauthors of Head First Design Patterns

Sure, you can pick up a book on design patterns, breeze through it, and think you've learned something, but we all know patterns and object-oriented design are deep topics. Like most complex subjects, patterns are best learned over a period of time, not in a few sittings. Truly understanding patterns also requires a lot of thought, insight into the true intent of each pattern, comparing and contrasting a set of patterns, and considering the trade-offs in using the pattern (not to mention understanding the basic OO principles behind each pattern). Sometimes it also helps to have a helping hand to get you over those little humps of understanding that are, for the moment, just beyond your reach.

So we've got a suggestion for tackling patterns that's fun and social, and provides a great environment in which to learn patterns: form your own study group. What's involved? Just getting a group of interested individuals together and dedicating yourself to reading and talking about patterns on a weekly basis. Any group of interested individuals will do, but better yet, get your own engineering team together to study patterns on a weekly basis (and get paid while you do it!). Getting your own team together has another benefit as well, because patterns become even more powerful when your entire team understands the shared vocabulary created among the group members and the real underlying structure of the pattern.

Figure 1

Of course, study groups are nothing new; whether for studying classic literature, discussing cinema, or learning about patterns, they have been around for ages. In fact, Joshua Kerievsky has already put together an excellent guide to forming a study group for the classic Design Patterns: Elements of Reusable Object-Oriented Software, by Gamma, Helm, Johnson, and Vlissides (otherwise known as the Gang of Four). If you're thinking about forming a group, you'll find lots of good tips on his site.

The focus of this article, however, is to get people started forming study groups using the Head First Design Patterns book. First, we should talk about the difference between these two books. The Gang of Four (GoF) wrote the classic design patterns book; it's the book that got the design patterns movement rolling, and no engineer's bookshelf is complete without it. The GoF book is part introduction to design patterns and part catalog of patterns.

Head First Design Patterns was written to be a learning guide to design patterns. It closely mirrors the patterns in the GoF book, but is focused on helping you understand the patterns and the fundamental ideas behind them rather than providing you with a catalog of the patterns. (That's what the GoF book is for!) We fully expect that once you've read and understood Head First Design Patterns, you'll find other uses for it (a doorstop? firewood? bicep curls?), and you'll move on to pattern catalogs. But to help you get up to speed on the who, where, what, and why of patterns, lots of developers are starting with Head First Design Patterns.

A Simple Recipe for Starting a Study Group

To start a study group, you need the following ingredients:

The moderator is responsible for finding and advertising a place and time to meet. As the moderator, you'll set the schedule of readings, run the meetings (acting as a guide, not an authority), and keep the discussion moving. You may also want to assign particular questions for participants to consider before the meeting. Questions provide a great way to get things going in a meeting and lead to further discussion. We'll suggest some questions and an order for the readings in the next section.

Participants are responsible for completing the weekly readings before each meeting, showing up on time, and participating actively in discussions. The participants may consist of your own development group, a handful of interested individuals from your community, or a group of students in a college course spending time outside of class to make sure they get it.

You can meet anywhere that is comfortable and allows easy discussion: your conference room, a local high school classroom in the evening, or the local Starbucks (although whiteboards are usually helpful in discussions).

A Sample Plan with Head First Design Patterns

Because Head First Design Patterns was written as a learning guide, it's easiest to study it using the existing sequence of the chapters. In particular, the OO principles used in the book tend to build on one another, so rearranging the chapters could lead to some confusion.

We suggest tackling a chapter per week depending on the time you have available for your meetings and for outside study. If you're short on time, some chapters can be conveniently broken into two weeks, such as:

The rest of the chapters should be easily handled in one week each.

It's always good to have participants consider a few questions as they read, in order to help get discussion started in the meetings. We'll start you off, but we're expecting you'll come up with even more interesting questions, and we encourage you to post them in the Talkbacks section of this article so others can make use of them. If the collection grows large enough, we'll organize them on the O'Reilly web site (giving full credit to the authors of the questions).

Here are a few to get you started:

Chapter 1: Strategy Pattern

Chapter 2: Observer Pattern

Chapter 3: Decorator Pattern

Chapter 4: Factory Patterns

Chapter 5: Singleton Pattern

Chapter 6: Command Pattern

Related Reading

Head First Design Patterns
By Eric Freeman, Elisabeth Robson, Kathy Sierra, Bert Bates

Chapter 7: Adapter and Facade Patterns

Chapter 8: Template Method Pattern

Chapter 9: Iterator and Composite Patterns

Chapter 10: State Pattern

Chapter 11: Proxy Pattern

Chapter 12: Compound Patterns

Chapter 13: Better Living with Patterns

Now It's Your Turn

Well, that should be enough to get your started; all it takes is a few people with the interest, our book, some time, and a meeting place. We look forward to hearing how your studies go!

In October 2004, O'Reilly Media, Inc., released Head First Design Patterns.

Elisabeth Robson is an author and software developer. She is coauthor of O'Reilly's Head First Design Patterns and Head First HTML with CSS & XHTML.

Eric Freeman is a computer scientist with a passion for media and software architectures and coauthor of Head First Design Patterns. He just wrapped up four years at a dream job--directing internet broadband and wireless efforts at Disney--and is now back to writing, creating cool software, and hacking Java and Macs.

Return to ONJava.com.

Copyright © 2009 O'Reilly Media, Inc.