Applying design patterns unconsciously 1
I just realised something about the workings of new style Typo Sidebars: it’s just an application of the Parameter Object design pattern; the render_sidebar helper method takes a Sidebar parameter object and produces a chunk of HTML. The fact that we persist the parameter object using ActiveRecord is almost beside the point – the persistence is more important to the render_sidebars method than anything else.
Old style sidebars couldn’t really be called an application of any design pattern. Maybe that’s what bugged me about them, they lacked the Quality Without a Name. I’m not sure that the new sidebar architecture has the Quality either, but it’s much nearer to having it.
When I was learning to play Go someone told me that it’s easier to remember professional games than those of amateurs because the moves in a professional game are generally more ‘right’ than those of weaker players. To a good go player, the ‘right’ move has an obvious purpose (or, more likely, purposes). Bad moves don’t.
Maybe something similar applies to code. In good code it’s clear what each piece does – maybe it can be seen as an example of a design pattern, maybe not – and the pieces relate well to each other. In bad code, the intent and relationships are muddied.
Do Design Patterns Help?
Continuing the Go analogy, Design patterns can be likened to joseki – ‘standard’ patterns of good play in the opening of the game. It’s useful to know them, but what’s really important, and what takes time, practice and deep study to get good at, is using and adapting them well in the fuseki – the opening and its wider context. You can play a ‘perfect’ joseki in one little corner, but its influence radiates across the board and if you don’t pay attention to what that influence is and use or adapt it well, you’re screwed.
I think the analogy to the use of design patterns in programming is fairly obvious. Don’t you?

A former lecturer (Ilkka Kokkarinen) at my local university happened to like Go. He wrote a book about data structures and algorithms in Finnish (which, obviously, you couldn’t have read given that you don’t speak much Finnish) something like five years ago. Anyway, in the book he makes the exact same analogy about Go, joseki and fuseki and how they are related to programming and algorithms.
I find it very cool and interesting that you thought the same. Being a go player myself, I also think the analogy is a very good one :-)
As a sidenote, I don’t know if you are aware of it, but in the classic go book “Lessons in the fundamentals of Go” the author claims something like this (quoting from memory): “There can be hardly anyone who does not know the meaning of the word joseki these days. It has become a common term used to describe any fixed set of proper action.” He is speaking about Japan of course.