Getting Started with Test Driven Development

May 8, 2009

I’ve been to wanting to learn and use Test Driven Development for quite some time now.
I’ve read tons of blogs, even a really nice free ebook (see here).
Unlike other new (to me) frameworks and technologies that I’ve been interested in before, I find starting to use and implementing TDD extremely hard.

It just didn’t feel right.

At first I thought, well, this might simply not be my cup of tea, but then it got me thinking, why would that be so?

After thinking it through, it finally hit me, and that’s when I decided I have to learn and start using TDD.

The way I’ve gotten used to writing code is wrong.

I’m a strange mix of a “speedy patcher” and a “write to only what you need to fix/implement” kind of programmer. I thought that was a good Agile thing.

The fact is that if what I’m writing is not interesting to me (aka boooooring),  it takes way more time to finish. Even if I understand the end value of what I need to do. I just can’t keep my concentration on the task at hand.

This approach tend to lead to :

  • heavily coupled code
  • magic fixes - “Ahh finally works, let’s move on to something cool” 
  • code with extremely expensive maintainance - A lot of “//WTF” comments 

Even though it might take a while, learning TDD has climbed way up on my TODO list.

Cheers,

Erik

comments powered by Disqus