📝Design Patterns

§ Software Design


The sort of people who hold one book as a bible, and don’t analytically synthesize that book’s content with other ideas and disciplines, will produce crappy software regardless of which book they choose. But if they absorb the ideas of (for example) GangOfFour, MartinFowler’s RefactoringImprovingTheDesignOfExistingCode, and YouArentGonnaNeedIt from EmbraceChange, and they weave those ideas into a cohesive gestalt, they will probably not frequently misapply the ideas from those books. If they continue reading, even just one book every month or so that doesn’t have 21 days, Definitive, Understanding, Mastering, Instant, or Dummies in the title, they’ll probably become pretty good. (See also FooOneOhOneInSevenDaysForDummiesInaNutshellSuperBibleUnleashed.)

The problem is not that the programming masses are finally studying GangOfFour and DesignPatterns. The problem is that they do not go far enough in their studies. Don’t discourage design patterns – encourage further study.

Often the Pattern novice will spend the next month at work writing the GangOfFour patterns into everything, even where they don’t belong. I know I did. I have this cauliflower shaped UML diagram to show for it. This will familiarize yourself with what patterns are.

Once this is done, some will graduate to journeymen. You will only use the GangOfFour patterns idiomatically. Maybe you’ll read other patterns and mine some of your own. You’ll start applying variations of the patterns you’ve read. This process familiarizes you with how patterns work.

Finally, some might become masters. A master will no longer use patterns except where they would occur naturally. After all, this is really what patterns are, the natural solution to the problem that have repeatedly arisen even before they were written. Sure, she will read more patterns, but only to understand the elegance behind them, not to memorize their structure. She might write more patterns too, but to describe the elegance.

I could be wrong, but the point is many people are novices. They just use patterns for everything because they don’t know how to program. Some have stopped doing this, and have returned to a more selective approach. This characterizes most programmers who have a lot of experience solving programs. Very few really grok programming well enough to consistently find the natural solutions to problems, and perhaps no one does. – SunirShah

The problem I have with patterns is that I’ve seen programs of people who obviously think: “The more DesignPatterns I use, the better is the design.” I think that’s what Sunir means above with novices. And I did that too. – ThomasHolenstein