Let me set this out from the beginning: I think it is a formidable strength for any industry or craft to constantly challenge perceived wisdom, and not be afraid to tear down any taboos.

Now let me tell you a story.

Several years ago, there was a book written by some influential people in the world of software design about OO programming design patterns. It included many of them, with explanation of why they’re the appropriate solution for certain problems and examples to go with it. One of them was the Singleton pattern.

Years later, it started to get highlighted as an anti-pattern instead, again by several influential people (Steve Yegge’s post on it is funny and insightful as always). Even more examples of inappropriate uses were quoted, with many people going as far as declaring it has no valid uses whatsoever. Singleton pattern is dead.

Is it really so? Is it possible that the clever, experienced and influential software craftsmen that came up with it in the first place were so wrong that the pattern has absolutely no valid uses? That we were all so deluded by their beautiful rhetoric and used it in a multitude of situations, none of which were valid? That they were simply 100% wrong, but with the benefit of hindsight they’re 100% right now?

I’m finding it hard to believe that. I’m finding it much easier to believe that a lot of misuse of that design pattern emerged, leading to its disrepute. I’m very happy to accept that many - or even all - of the times that I used it personally were such misuses. I’m happy to accept that 99% of the time it was used, it was in the wrong way and led to bad design. But I’m finding it hard to believe that a design pattern that was once widely accepted as valid (by much cleverer people than me) is in fact completely invalid.

Here’s the other story, more recent this one.

TDD has been widely accepted as a Good Thing. One of its advertised benefits is that it encourages good design of your code. Yet here are now some influential software craftsmen declaring its death - with one of the reasons quoted that it actually encourages bad code design. TDD is dead.

And my reaction remains the same. Surely it can’t be a completely destructive practice? Surely it may be the case that TDD should be done some of the time rather than all the time, is some situations rather than all, rather than declared a Bad Thing? Could we all really have been that deluded all along?

Your (and my) feelings on the Singleton pattern and TDD aside, this feels a lot like following fashion. Let me reiterate, I think it’s a brilliant thing to question current wisdom and evolve good practices in our - and any - profession. But this pattern (pardon the pun) feels more like a new book, blog, manifesto, or what have you, gains prominence, the majority of the industry follows it as gospel, and when it’s been followed in anger and is proven not quite so perfect, the majority of the industry abandons it for the Next Big Thing (and the minority that never followed it in the first place help themselves to a massive serving of I-told-you-so). Even Steve Yegge’s post, after very aptly and entertainingly bashing the Singleton pattern to the ground, hints at just that: that there are a few valid uses for it, but there are so many misuses that it’s better to declare it evil.

My point is that I would much prefer to see an open-minded examination and trial of the Next Big Thing (as is fortunately happening to some extent). And when it is shown in time to have some weaknesses as well as merits, to evolve, iterate, or selectively use it where it is proven to be useful. Much better to do that than to move it from the pile of Good Things to the pile of Bad Things, as if the majority of the software professionals are not intelligent enough to understand the nuances of where to use it and where not to.

And if that’s actually true about the majority of software professionals, then that’s the problem that needs fixing.