SN

March 15, 2018

TDD allows you to offload your thinking onto the computer

One of the best parts about test driven development is that you get to offload your thinking onto the computer.

Before I used test driven development I would have to maintain a mental model of my software. If I wanted to add a feature, I would spend a long time (relatively speaking) trying to think of all the ways the new feature might affect existing functionality.

With TDD I simply press a button, and within seconds the computer will tell me whether things are working, or that I’ve wreaked havoc.

Kent Beck actually writes about this in Test Driven Development By Example

Rather than apply minutes of suspect reasoning, we can just ask the computer by making the change and running the tests. In teaching TDD, I see this situation all the time—excellent software engineers spending 5 to 10 minutes reasoning about a question that the computer could answer in 15 seconds. Without tests you have no choice, you have to reason. With tests you can decide whether an experiment would answer the question faster. Sometimes you should just ask the computer.

The robot overlords are coming anyway, so you might as well get used to asking for their advice.

Are you new to Test Driven Development?

Join the mailing list! :)