Obvious Implementation

Obvious Implementation

I've been studying TDD and XP for only 6 months. I'm totally on board with the practices, just struggle sometimes. :)

I'm sitting waiting for an oil change to finish and reading Kent Beck's "Test Driven Development" and it calls out something that I think is invaluable to understanding how to apply TDD.

In Chapter 2, p13 in my copy; Beck mentions strategies for quickly getting to green.
The purest form of TDD uses the Fake It method. You expect a 10, hard code 'return 10'. You are taking the data.

This strategy is what I've been presented with. That you do the smallest steps you can to get green. It is hugely valuable, I accept it as the way to learn TDD, as it's the base strategy to revert to when you get an unexpected red.

The other strategy Beck lists here is, as titled, "Obvious Implementation".
I've been doing this to be more productive, and kinda feeling crappy about it. Felt like I was short cutting the TDD flow because, "I know where the code will go, it's obvious".

A third strategy is listed, but will be discussed in a later chapter.

As I sit at the service center, I found the explicit strategies valuable enough to type this sort post on my phone.

It will be a great tool for myself and to help ease others into practicing TDD. The issue will come up about what is 'obvious' but if you practice TDD obvious is very small.

I see my car pulling out of the shop, so until next time...

Show Comments