PHP in Action

The psychology of test-driven development

dagfinn | 02 June, 2008 12:46

Silvan Mühlemann has written an excellent piece titled Unit testing makes coding more fun.

I keep saying that sort of thing, too. I also say it raises your IQ. But when I attended a presentation by Uncle Bob (Robert C. Martin) last summer, I was mildly shocked to see that he described TDD as tedious (but a requirement for professionalism). I confronted him politely about it, emphasizing that above all I find TDD relaxing. Why? Because bugs bug me. I get stressed when I have to search for a bug and even more so when it takes much longer than expected (I'm sure that never happens to you). With TDD, bugs are always small and easy to locate.

Uncle Bob seemed to agree with me as far as his own experience was concerned, but he believed that many developers found the non-TDD process exciting rather than stressful.

Sounds weird to me. But I know from long experience that sometimes people are different from me in ways that make reality seem stranger than fiction.

Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
    blogmarks del.icio.us digg NewsVine Reddit

Comments

Re: The psychology of test-driven development

Peder Rice | 02/06/2008, 16:46

I will refer you to a favorite essay of mine:

http://paulgraham.com/newthings.html

The fun of programming, in my mind, is to craft a design that hasn't been done before.

Testing and implementing aren't exactly new and exciting, and I therefore find them tedious.

Re: The psychology of test-driven development

dagfinn | 02/06/2008, 22:21

dagfinn

That's an extremely interesting essay; thanks for pointing it out. It's a lot like what I try to do, and there's no actual contradiction. There are degrees of fun and tedious. At some point, you have to implement something, and hopefully in the least tedious way you can find.

Re: The psychology of test-driven development

Travis Swicegood | 04/06/2008, 11:14

Peder, the point of TDD is that you are forced to figure out what problem you are answering. What does the API look like? What's the reaction when I call the method? When is this thing done?

When you've answered those questions in the a way that will keep you accountable - the tests - then, and only then, you get to craft the simplest solution to make it work.

It's not "testing" in the traditional sense. Don't worry, you're not the only one who doesn't get it :-)

 
Accessible and Valid XHTML 1.0 Strict and CSS
Powered by LifeType - Design by BalearWeb