Channels ▼
RSS

AntiPatterns - Refactoring Software, Architectures, and Projects in Crisis


July 1998/AntiPatterns - Refactoring Software, Architectures, and Projects in Crisis


Title: AntiPatterns — Refactoring Software, Architectures, and Projects in Crisis
Authors: William J. Brown, Raphael C. Malveau, Hays W. "Skip" McCormick III, Thomas J. Mowbray
Publisher: John Wiley & Sons, 1998
Pages: 309
ISBN: 0-471-19713-0
Price: $39.99

AntiPatterns are an attempt to catalog the mistakes and practices that contribute to software project failure. Like patterns, AntiPatterns have associated "forces," and consequences. But AntiPatterns go one step further in suggesting ways out of bad situations. AntiPatterns are not exact opposites of the design patterns popularized by Gamma et al [1]. Those patterns describe interactions of software components. By contrast, AntiPatterns are a mixed bag of architectural, process, and human problems. They are typically "implemented" without full awareness of project participants, and they tend to manifest over a period of time, like a slowly growing cancer.

An example of an AntiPattern described in this book is the Lava Flow AntiPattern. You know you're in a Lava Flow pattern if you keep finding old code that doesn't seem to be used anymore, and yet you're reluctant to delete it, because - well, who knows what might break? In the words of the book, "the Lava Flow of obsolete technologies and forgotten extensions leaves hardened globules of dead code in its wake."

This points to another difference between patterns and AntiPatterns, and the difference shows up clearly in this book: AntiPatterns are more fun to read about, especially if you're not in the throes of one yourself. AntiPatterns also tend to have humorous names. Some of my favorites from the book are The Blob, The Corncob (referring to a person), and Death by Planning. It would be a mistake, however, to conclude that this book was a high-minded spoof of the Patterns movement. The authors are true believers in Patterns, and they are serious about patterns and AntiPatterns alike.

The purpose of this book is to help you see when you have entered the gravitational field of an AntiPattern, and to show you how to get out before your project spirals into oblivion. The book describes 18 major AntiPatterns (and even more "mini AntiPatterns") in three categories: software development, software architecture, and software project management. All three sections make for interesting and entertaining reading.

AntiPatterns introduce a feature not found in plain old patterns: the refactored solution. In software, refactoring involves rearrangement of code, but the refactored solution refers to a much broader concept. In fact, I'd say a little too broad, but more on that later. A refactored solution might involve anything from rearranging class hierarchies to acquiring new technology. It is something that opposes the ill effects of the AntiPattern, either by prevention or as an antidote.

Eat Your Peas

Some AntiPatterns are actually good patterns gone bad. This can happen when zealous new believers try to apply a pattern where it doesn't fit. A pattern applied in the wrong context becomes an AntiPattern. Maybe that's why the authors take such pains to set the proper context before describing AntiPatterns in detail. (An AntiPattern can also be misapplied, after which it becomes, I suppose, an AntiAntiPattern.) So the first four chapters of this book focus on the nature of patterns, of AntiPatterns, and how they relate to software development.

The authors are really attempting two things here. They want to set the context for AntiPatterns, and they want to remedy some problems that plague patterns in general. A couple of problems identified in the book are difficulty in finding the appropriate patterns, and difficulty in assimilating them once found. The authors' solution includes an elaborate, layered, software development model, and a near-dictatorial insistence on the use of patterns templates to separate the wheat from the chaff. Beyond that, this first section reads pretty much like any book on software project management. You encounter models, principles, theory, an anecdote or two along the way. I feel duty-bound to tell you to "eat your peas" - you probably shouldn't skip these chapters. But it's hard to resist moving on to the fun stuff.

Some Words about Words

I like this book, but I don't like its potentially corrosive effect on the English language. For starters, this book has appropriated a perfectly clear word, refactoring, and hitched it to a perfectly vague concept, the refactored solution. The reason this term gives me such heartburn is because it seems to promise a lot more than it delivers. Some of the AntiPatterns described in this book clearly have no solutions, once you're in the thick of them, beyond starting over. In these cases, the "refactored solutions" offered are merely preventive, and in fact may have nothing to do with any kind of refactoring as we know it. So if this book becomes popular, look for "refactoring" to become another buzzword - a euphemism for "we're trashing everything and starting over from scratch."

I always groan inwardly when some new vulgarism makes its way into the language. Until I read this book, I thought gaudy concatenations like "AntiPattern" were safely confined to press releases and source code. No more. Now we must all deal with four forms of compound words (antipattern, anti-pattern, anti pattern, AntiPattern). If I edited a dictionary, I think I'd jump off a bridge.

One final complaint, and then I'm done. This book repeatedly cites a study claiming five of six corporate software projects are failures. That's an astonishing number, until you figure out that "failure" can also include going over budget or missing a scheduled completion date. I hardly think a programmer who had sweated blood on a project would appreciate such a dismissive assessment.

Indeed, the authors are a mighty grim bunch when it comes to software development, but at least that keeps them from indulging in too much hype themselves. They justly point out the failure of past revolutions - structured programming, open systems, OOP, etc. - to create a software heaven on earth. It is sobering to realize that each of these paradigms, in its own time, seemed to hold the answer to all our problems.

How to Use This Book

I think that if you read this book, you can't help but absorb some general programming wisdom. But I can see two specific ways this book can be helpful to programmers. If you sense that the project you're on is headed for the sewer, this book will help you articulate what's wrong to your project manager. That could make a remarkable difference in how things turn out. If you are a lead programmer or manager, imbibe this book as a good stiff dose of preventive medicine. Maybe you can avoid becoming a statistic for Edition Two.

Reference

[1] Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides. Design Patterns, Elements of Reusable Object-Oriented Software (Addison-Wesley, 1995).

Marc Briandis Editor-in-Chief of C/C++ Users Journal. He loves programming, writing, and too many other things for his own good. However, he hates to work, which is why he is an editor. He may be reached at mbriand@mfi.com.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 

Video