My definition of TDD#

There's been a lot of fuss lately around the Guidelines for Test-Driven Development (TDD) that's just been published on MSDN.

I don't want to join the mud-slinging fest since I don't feel I can adequately represent the Agile community here, but this seemed like a good time to mention how I see TDD:

Test-Driven Development is like going to the grocery store with a shopping list.

Hear me out.

If you need to go grocery shopping, you can take what I'll conveniently call the "bachelor approach", which means going to the store, traversing all the aisles, throwing everything in your cart that looks remotely delicious, and not knowing in advance how much you'll wind up spending. As you mature (which is an optional step), you'll notice that you're spending way too much money on stuff you don't actually need or can't use. So in time (or until you meet someone with more experience), you'll probably start thinking in advance about what you actually need, making a list before going to the store and then buying only what's on that list. That way, you'll have a much better idea in advance what you'll be spending and as you do this more and more, you won't get caught with groceries you don't need or have to throw away.

As I see it, this is just what TDD offers: by defining the specifications for your software (the shopping list) before implementing them (actually shopping and buying), and then writing only the minimal amount of code that's necessary to meet these requirements (only buying what you have on your list), your budget will be more predictable and you lower the risk of feature creap by not going wild on features you don't need.

That said, the "bachelor approach" can of course be more fun, and yield some pleasant surprises. But in serious enterprise software development, this is often a luxury that you can't afford.

Update: Sam Gentile has just posted a more accurate definition of TDD (mine isn't 100% waterproof but I think it helps transmit the message), and Microsoft's Rob Caron has announced they'll be fixing the original article that caused the upstir. Now if Microsoft would only pull all the pages off of MSDN that show how incredibly "cool" and "productive" it is to go straight from your GUI to the database, while failing to mention that there are reasons why you would want additional layers in between. The definition of n-tier should really include the precondition "where n > 2".

Comments are closed.
All content © 2014, Jelle Druyts
On this page
Top Picks
Statistics
Total Posts: 351
This Year: 0
This Month: 0
This Week: 0
Comments: 530
Archives
Sitemap
Disclaimer
This is my personal website, not my boss', not my mother's, and certainly not the pope's. My personal opinions may be irrelevant, inaccurate, boring or even plain wrong, I'm sorry if that makes you feel uncomfortable. But then again, you don't have to read them, I just hope you'll find something interesting here now and then. I'll certainly do my best. But if you don't like it, go read the pope's blog. I'm sure it's fascinating.

Powered by:
newtelligence dasBlog 2.3.12105.0

Sign In