Design Patterns are not a Silver Bullet and the State of the Programming Blogosphere

Design patterns are not a universal tool that can be applied to any project or be used with any programming language. Quality code can be produced without implementing any pattern or even without using OOP. One shouldn’t think of their colleagues as of bad developers if they don’t know the names of fancy design patterns. Moreover, not any single programming project is a business application.

Recently I have read so many blog posts where authors ranted about design patterns, test-driven development and similar stuff. It feels like many people approach design patterns as a silver bullet that will help them to solve any tricky problem they may encounter. Furthermore, the same people become really angry if somebody thinks out of the box and simply disagrees with their ideals. I don’t imply that the majority of programmers think so, but the blogosphere tend to be in such a state. At least, the blogosphere I’m circulating in, being mainly a web developer I mostly read about web related technologies. Sometimes, it’s even amusing to read people’s reaction to the opposite opinions, especially if an opinion is expressed by Joel Spolsky. Frankly, it looks like almost every programming blogger feels honoured to disagree with Mr Spolsky.

Anyway, design patterns don’t deserve that buzz they are getting. Most of design patterns are so obvious that it is even silly to read or write about them. For instance, I’ve come across a great number of articles about Dependency Injection that in fact is a pretty trivial thing. Every smart developer is able to come up with it when he needs it. There is no point of trying to memorise every single pattern, because it can lead to its stupid implementation when it’s completely undesirable, for example, in small projects where the patterns implementation code can become bigger than the code performing some real job. Of course, I don’t think that it is bad if a common programming technique has finally got the name, but it is stupid to think that if somebody doesn’t know what “dependency injection” is, then he will never produce good code. “Dependency Injection” is hardly more than just a name.

In addition, design patterns and even OOP are not universally applicable. There are many programming projects besides business applications and often you are limited by the resources you have. Many popular applications that are used by everyone are written in pure C which doesn’t support OOP. However, this doesn’t mean that the code written in C is bad or “smells” as some design patterns followers would say. There is a great presentation called “The (lack) of design patterns in Python” on this topic.

Also, a gap between different worlds of programming often leads to misunderstandings when, for example, somebody tries to prove that everyone should do test-driven development even when programming with a Assembly language. It’s usually the design patterns adepts who can’t imagine that programming isn’t all about writing cus tom business applications.

Indeed, even if we are just web developers we are still fascinated with other stuff, like computer games with mind blowing graphics or convenient operating systems or precise search engines and a lot more, but when people create all that software they think not about design patterns but about useful and fast algorithms.

Mike Borozdin

Monday, January 04, 2010

blog comments powered by Disqus