1 Oct 2007

Most Programmers Don’t Write Tests (and never will)

This article/survey inspired me for this post.

Extreme Programming has been around for the last 10 years but there is still a minority of people using it on a daily basis and I fear it will always be a minority.

I consider myself an addict to TDD. I won't explain what it is... I hope you already get the picture.

When I discovered it I got the "Woh !" feeling. At least a technique to write code with less bugs !
I tried (and in some case succeed) at doing some TDD evangelism.

My first opinion was that it was just a matter of educating people, I never learn this technique at school, neither in the enterprises I worked for... I learned it by reading blogs/books and so on.

But despite my efforts it seems it always ends-up in some sort of "rotten state".

The tests end up disable to do refactoring, people don't write tests first because they are stress and/or just want the thing done or other valid reasons in the sort term.

Developers just want immediate feedback and people always choose the "Path of least resistance". Doing tests is just harder because you have to face other problems ("how do I isolate my tests", "how do I avoid depending on a database", "I need to change my api to make it testable"...)

I think it's just human nature and human nature just don't change.

Take this extract from Jackob Nielsen usability guideline:
Overall, though, whether you look at application or website guidelines, usability guidelines remain remarkably stable across decades. That's because they depend on human characteristics, which don't change that much.

That why I dropped the evangelism thing :(

I just use this technique for me, show it to others and even explain it if I feel the person is responsive to it. May be some will find it useful but I doubt it will become the main way to code... Too bad :(

Technorati tags:


NetManiac said...

In Poland, we have saying which is good illustration why evangelism mostly fails.

Opinions are the only thing You can exchange, and still have the old ones

I hope it still makes sense after my translation ;)

Hafiz Pariabi said...

If you familiar with David Allen's GTD, it's quite similar case and he suggest not to bother changing people to do it, just focus on yourself.

Personally, my way of introducing it is in context, have something to show or work on problem that genuinely need it (not some made up toy problem). It's not always pretty, some problem will be not natural to test, but that's where it will leave the most impression for other people (and most importantly, a lesson and a humbling experience for us).

In short : preaching does not work (most of the time), visible action (mostly) does.