Design patterns. Not for eating.

So what are they for? My interpretation of design patterns are they are off-the-shelf receipes for solving common problems. Common problems are re-occuring problems that transcend the boundaries of software projects, for example different projects may have to use trees as abstract data types at some point in their architecture. Therefore each project will face the same problems when working with trees. Enter the visitor pattern, its like the computer science version of Mary Berry cooked up a receipe for working with trees, one that allows us to seperate our concrete tree data structures from the cutlery draw of algorithms (updates, searches, selections, etc), and the point is you can trust it works.

 Perhaps I am a control freak; but I am not convinced that I like design patterns. I do not deny they serve a good purpose; “why re-invent the wheel / why not stand on the shoulders of giants?” – why would you not use a tried and tested design to solve a common problem? Design patterns provide a standard, if everyone comes up with their own way of solving a common problem then we need to spend some time explaining to anyone else interested how they solved this problem. I think there is even an argument that they provide a talking point, design patterns highlight common problems, and therefore provide a platform from which we can discuss common problems. In the SAPM lectures for example we see that design patterns are a language smell, this surely is an example of design patterns providing some perspective on some of the short comings of current languages, and therefore enters a discussion.

 So for all the good in design patterns, why would I not be convinced? I will clarify what I mean: I don’t believe that design patterns are a silver bullet for solving commonly occuring problems if they are being used by anyone but an experienced programmer. Why?

I think there is something to be said for learning from your mistakes, and if you don’t spend some time trying to solve the common problems then you miss out on exploring a well trodden path. If many other people have already spent time on an area you can assume there will also be a lot of related discussion, discussion that will be a helpful resource in learning.