Home » General Computing

Vegetable Design Patterns

17 September 2007 No Comment

Design Patterns are great and you’ll always hear "architects" throwing words like "pattern", "model view controller", "factory", "singleton", "observer" and "command" around to give their statements a little more weight.  It’s rare you hear anti-patterns discussed however.

A while ago someone made the claim that there was only one way to implement a pattern. This struck me as a remarkable statement as the very word "pattern" implies no specific implementation. A pattern is an abstract notion that has potentially many implementations, that’s what makes it so useful. Most people start with the GoF Blue Book on patterns but you may prefer the "Non Software Examples of Patterns" [LINK].

Talk to any java person for more than 5 minutes and they’ll throw up the MVC all over you. This is a nice pattern but many folks don’t understand it. For example just this morning I heard an "architect" refer to the MVC as Model, View, Controls. They described implementing the View using CSS and the "Controls" using tag libraries. Ho-hum.  Even more common is that folks don’t realize there are two MVC patterns, model 1 and 2.

A lot of Patterns turn into Anti-Patterns because folks blindly follow the pattern without understanding the pattern. For example someone recently told me you shouldn’t implement the Abstract Factory using reflection. Riiiigghhht.

So maybe a new description of patterns is needed. I’ll offer this one up using something that’s easy to understand: Vegetables.

  1. The Onion Design Pattern; This is a "layered architecture". Instead of 2 or 3 layers, you actually have 20 or 30. Opening it up usually makes you cry.
  2. The Asparagus Design Pattern; This pattern is generally tasteless. You’ll think all is fine until hours later when you visit the bathroom.
  3.   The Artichoke; Another layered design; In this case almost 90% of the code-base can be cut out and discarded.
  4. The Mushroom; Not a true vegetable design pattern. This one grows up overnight. All is usually fine until you cut into it and millions of spores are released into the air.
  5.   The Sprout; A malleable design pattern, usually implemented in a "new & fresh" technology like "Ruby on Rails" or "Grails". Sometimes referred to as "Agile" but unable to support any load.

I’m sure there are more…

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.