A pattern in patterned confusion.

Chad Osgood talked this morning about a semi-rant from Bruce Eckel about patterns and the Gang of Four (GoF) book in particular. Reading the snippet from Bruce, I do not see why he (Bruce) critisizes the GoF book that much. As an example he shows the diagrams of the strategy pattern and the state pattern. They look familiar indeed, but they are semantically different, and that's why they form different patterns. When swapping algorithms you use the strategy pattern. When swapping state objects you use the state pattern. A different world altogether. The UML-ish diagrams may look familiar, but they're not.

Patterns are not about neat algorithms, they are about giving names to common used ways to solve solutions. At first I looked at patterns in a way to solve programming problems in a clever way. This is not the right way. Patterns are common, well known solutions, like quicksort and double-linked list are common well known ways to do things. They have names, we know what kind of routine(s) are associated with these names. That's also the case with patterns: common used ways to solve problems have been given a name, so when we hear 'Factory pattern' we know it's about an abstract class which creates a new object but using a virtual method which is overriden in a derived class.

What really disturbed me was that Martin Fowler came up with a whole new set of patterns which are most of the time simply re-implementations of the GoF patterns. Allthough Fowler did a wonderful job investigating all the patterns, it will add to the confusion. If that wasn't enough, our buddies over at Sun Microsystems have done their part in adding more confusion to the fragile pattern-movement.

Patterns are a great help to the developer's way of organising knowledge. Now we only need a new pattern: to organise the patterns. :)

1 Comment

  • I completely agree Frans. In fact, one of the requirements for being a design pattern is that it *must* be used by more than one group of people. You simply can't invent something new yourself and call it a pattern unless it's something other people have come up with as well.

Comments have been disabled for this content.