The Clean Code Blog

by Robert C. Martin (Uncle Bob)

Professionalism and TDD (Reprise)

02 May 2014

Lately I have been criticized, both directly and indirectly, for associating TDD with professionalism. Indeed, I believe much of the recent “true believer” rhetoric we have been subjected to comes from that association.

I plead guilty to claiming that the association exists. I wrote extensively about it in the article Professionalism and Test-Driven-Development, IEEE Software, 06/2007

Now, let me preface this by saying that there are a number of programmers whom I respect and honor who either do not practice TDD or do not consider it to be associated with professionalism. Jim Coplien (Cope), Rich Hickey, and David Heinemeier Hansson (DHH) to name a few.

  • As I have said many times before, Cope is a hero of mine. His writings in the 90s and since have had a huge impact on my way of thinking and my career.
  • Rich Hickey is the author of Clojure, and someone with whom I have had several discussions back in the 90s, when he was a C++ programmer. I currently use Clojure as my primary language, and I try to read as much of Hickey’s writings, and listen to as many of his talks, as I can.
  • DHH is the author of Rails; a framework that has done more for the Ruby community, the web community, and the whole software industry than any other I can think of. His influence on me, and on the industry is incalculable.

These are good, solid, honorable, professional programmers. I use their work. I trust their integrity. I am privileged to have met and learned so much from them. They’ve proven their professionalism. They don’t need me to ratify it for them.

So how can I believe that TDD is associated with professionalism when there are professional programmers, whom I hold in high regard, who don’t agree with that association?

First of all, if you read that article from 2007, you’ll see that I don’t believe that TDD is a prerequisite to professionalism. What I believe is that it currently plays a significant role in professional behavior. I also believe it will play a much greater role as we look into the future.

In that article I briefly referred to the story of Ignaz Semmelweis who in 1847 achieved a six-fold drop in his maternity ward’s mortality rate by simply having doctors wash their hands before examining pregnant women. Semmelwies tried to convince his peers to adopt hand-washing as a discipline. They resisted – for over 60 years. The reasons for their resistance sound much like the articles we’ve seen of late claiming that TDD is dead.

Doctors at that time did not wash their hands. They saw no reason to wash their hands. To them, cleanliness and disease were utterly unrelated. To us, in the 21st century, that’s difficult to believe; but just 167 years ago it was just as hard to believe that washing hands was anything but a fools errand.

Were these doctors unprofessional? Of course not! They were doing the best they could with what they knew. Their distrust of Semmelweis seems unreasonable now, because Semmelweis was right. But it’s hard to fault those doctors for not following every fool fad that came along. It took time, and unfortunately it took a lot of misery and death, before hand-washing was adopted as a medical discipline.

If any doctors today failed to wash their hands, we’d call them unprofessional and drum them out of the profession. Such actions would be intolerable. But back then, those doctors who rejected Semmelweis where honorable, respectable, and professional. They weren’t evil. They weren’t even stupid. Their only fault was that they were human.

Now I realize that I’m casting myself in the role of Ignaz Semmelweis. It is not my intention to claim such iconic status. After all, I may be dead wrong. TDD may not be the equivalent of hand-washing, no matter how much I think it is. If that is the case, then Uncle Bob’s writings and preaching on the topic will fade into a humorous footnote in the history of software. A footnote that will be deleted after a decade or so. If that is the case, so be it.

But patients are dying out there! Healthcare.gov. Knight Capital. Toyota. The list goes on; and the casualties are mounting at an accelerating rate. Our society as a whole is becoming more and more dependent on the software we produce; and the failures grow in significance with every passing year.

Something must change … or we are headed for a catastrophe of existential magnitude.

If I am right… If TDD is as significant to software as hand-washing was to medicine and is instrumental in pulling us back from the brink of that looming catastrophe, then Kent Beck will be hailed a hero, and TDD will carry the full weight of professionalism. After that, those who refuse to practice TDD will be excused from the ranks of professional programmers. It would not surprise me if, one day, TDD had the force of law behind it.

Now, you may disagree with me about TDD. That’s fine, and I’m willing to have the debate with you. But I won’t call you unprofessional, and I won’t think you are unprofessional. Because today, at this moment in our history, TDD is not the prerequisite of professionalism that I believe it will become.