Thursday, September 24, 2009

Unit testing has it's place

Joel just published this: The Duct Tape Programmer
Go read. I'll wait.



In it, amongst other things, he seems to come across as saying that unit testing isn't worth it because it doesn't help you ship code/a product/a feature in a really short time frame.

But that's not the point.  Unit testing helps improve code quality by preventing bugs over the long term.  The value of unit testing is in the long term.

In the short term it's often better to have software with bugs in than no software at all.  This can help you beat a competitor to market or win that big new contract.
In the short term you're not worried about making a change to one part of the system and inadvertently breaking something else (which automated testing is really good at identifying) because you're not making changes, yet. You're just writing the initial version.

But, in the long run, if you want to keep that market share and avoid losing customers to a competitor with a more reliable product you need to make your software more reliable and contain fewer bugs.

In the long run unit testing will save you time (well maybe not you directly but the development/testing/QA team as a whole). That's the value of unit testing - over the long term.

I've previously written about the value of unit testing here.


  1. Guilty as charged m'lud..

    I am definitely a duct tape programmer. Not that I don't write unit tests or do testing, it's just not something I do for everything.

    But I do ship code fast :)

  2. @CodeMonkey - Yep duct tape rather than TDD in my opinion.

    Another post about the importance of Unit testing


I get a lot of comment spam :( - moderation may take a while.