RoleModel Software Home    Services    People    Process        More About Us    

Therefore, BOOM!

How do you write patterns in such a way as to deliver the most impact and be the most convincing?

Although I clearly remember first hearing about Patterns from Kent Beck (and Ward Cunningham) at OOPSLA '87, and have had many conversations with them and many others about Patterns since, I think the single most important thing I've learned about writing a good pattern was inspired by a talk Kent Beck gave at a workshop on patterns at OOPSLA '93. Since then, having written over a hundred patterns (or attempts at patterns) and having read over a thousand, I constantly come back to the same thing as the critical factor that separates the great patterns from the rest. I've talked about it with many, and some have said it has inspired them to the point where they can't get it out of their mind either although this hasn't been a universal effect. Perhaps this is why it is not captured in A Pattern Language for Pattern Writing. I've benefitted from it so much, but I never thought to write it down as I always wanted to give Kent the credit. On the other hand, I'm beginning to think that this is really a pattern for writing good patterns. Kent really didn't create it; he discovered it. And the first to discover it was probably Christopher Alexander, although he never wrote it down as such. Recently, Dwight Deugo, asked me to write it down for the benefit of others.

Therefore, BOOM!

If the reader can easily find the "Therefore, BOOM!" in a pattern, you've done well.

The best patterns give the sense of tension and release. As I read them and the forces are exposed I'm saying... "boy, this is a tough problem." or "I've never realized the subtle nuances that really need to be balanced in order to avoid further problems down the road.". Then, when I read the solution, I say, "Cool! This does a masterful job of balancing the forces without adding more problems than it has solved." Or to put it another way, it goes from "Huh?" to "Uh-oh" to "Oh no" to "Ahhhhh...". Of course the magnitude of the tension building and releasing is somewhat tied to the nature of the problem. I believe the GOF format of documenting patterns is a handicap toward achieving this goal, although it does not render the goal impossible. I like other forms that seem to read something like the following:

"You have this problem... what makes it a really hard problem is... if you do A then you get this benefit but have this nasty side effect... if you do B you get that benefit but this other nasty side effect, THEREFORE do C! Not only do you get this and that benefit, but you don't this and that nasty side-effect and here's why..."

I've kind of coined the phrase "Therefore, BOOM!". (NOTE: The rest of this paragraph was added after reading Jim Coplien's response to the original draft of this essay, Patterns Don't Need To Go BOOM! which can be found on the WikiWikiWeb). By "BOOM!", I don't mean it has to be startling, just an obvious release of tension as the forces are resolved. This could be "BOOM", "Aha", or even "the sound of a gentle blowing after a strong wind, earthquake, and fire" (see 1 Kings 19:9-13).

Many think that patterns should be studied deeply in order to really understand them. I disagree. Although I strongly believe one can always get a deeper understanding by reading something more than once, we need to be careful that we don't use this as an excuse for doing a poor job of communicating. The best patterns, articles, or books I've ever read have impacted me the first time I read them. There are times that I have read things and believed that I needed some prerequisite knowledge before I could really appreciate the thing I was reading. Often, these things point me to the assumptions about its audience and I'm grateful when they point me to sources for that prerequisite knowledge.

Just as we can gain a deeper understanding of wisdom by going back to it more than once, we can become more confused by dwelling on foolishness. Personally, I've only got so much time. I do not have the time to read everything I've ever seen identified as a pattern, and I certainly don't have the time to read them multiple times and study them deeply. How do I determine which patterns are worth reading, adhering to, and espousing? I rely on others I respect (due to the wisdom I've evidenced in them) to point me to good ones, and I sample others. Sometimes, I inherently understand the forces even if they aren't articulated well and can agree with the solution presented in the pattern. But, there are times when I come across patterns dealing with a problem of which I do not have a firm grasp.

I've found that I've been able to read patterns about C++ (of which I am far from an expert) and have been convinced that the pattern is absolutely correct and if I were ever faced with the problem presented while programming in C++, I would know what to do. I have read others that left me far from convinced that using the solution the author presented was the way to go. Why? He didn't convince me that he understood the forces present in developing software in general or this problem in particular and I couldn't find either the tension or a release from the tension. But, not being a C++ expert, how could I possibly make such a judgement.? Was I deceived by my criteria for judging the pattern? I've found that time and again, as I talk to real C++ experts, they point me to the same patterns I've judged correct, and away from the ones by which I was not convinced. This is far short from a scientific method, but I've begun to take it on faith.

I've never really liked the GOF format and have grown to dislike it more over time as I've seen others consistently used more effectively. On the other hand, I have seen GOF format used in patterns that do clearly communicate the forces in the Motivation section which seems to make it much more palatable. GOF is a great book because the authors put a lot of time into uncovering and documenting the patterns many experienced practitioners employed for years but never bothered to document well or put them together in a catalog of patterns. The form it takes is thorough, but sometimes the point is missed. If the reader doesn't already know the pattern, he often finds it difficult to figure out when and why you would use the pattern. This is particularly difficult after reading it only once.

If you are inclined, after all I've said to stay with the GOF form, don't discard this important issue. When using the GOF form, I'd recommend you work a lot on the motivation section and keep the tension building/release idea in mind as you do it. I find that without this in mind, the GOF form encourages spreading the "solution" (Therefore, BOOM!) portion around to a lot of places so it is hard to get the dramatic, one sentence release (the BOOM!). I'd recommend putting the one or two sentence "release" (the BOOM!) at the end of the Motivation section. I could be convinced that it may lie in another section. I'm not so sure I could be convinced that it could be left out and serve well the purpose of patterns… capturing and proliferating wisdom.

The book of Proverbs says in many places "The fear of the Lord is the beginning of wisdom." (see Proverbs 9:10). Throughout the Bible, when people are confronted by the Lord, He doesn't leave room for trying to figure out what it is he really meant between the lines of what He said. His truth is not just looked at as a bit of news that they picked up during the day. They are convinced that His words are not to be ignored. Real wisdom shouldn't be delivered with a thud, it should be delivered with a BOOM!

Go Back

Copyright © 2002-03 by RoleModel Software, Inc. All rights reserved.