What TDD supplies that test-after does not

I was talking with Nathan Ladd, one of the Eventide co-creators, the other day. He said something that really stuck with me.

When you have a bug, an error, really any condition where your system isn’t running the way you want it to, first elevate your level of understanding. Then the solution becomes obvious. If you don’t have an obvious solution, you don’t understand the problem well enough yet.

This made me think about Test-driven Development and why I believe it’s superior to a test after-the-fact strategy.

When you’re doing TDD, you don’t just run the tests after you write the code that’s supposed to make your failing tests pass. You state to yourself, if you find yourself in the unfortunate case of working alone, or to your team if you’re in an ensemble what you expect the code to do.

I often run the test I’m working on as I type each line of code needed to get the test to pass and see the errors I’m getting change as the code comes into focus. With each run, I predict not just that there will be an error but what the specific error is. I do this right up until the test passes.

This constant thinking through of what the code is doing drills into my head how it’s supposed to operate. I don’t see how writing tests after-the-fact could do that.

tdd 

Like this message? I send out a short email each day to help software development leaders build organizations the deliver value. Join us!


Get the book!

Ready to learn how to build an autonomous, event-sourced microservices-based system? Practical Microservices is the hands-on guidance you've been looking for.

Roll up your sleeves and get ready to build Video Tutorials, the next-gen web-based learning platform. You'll build it as a collection of loosely-coupled autonomous services, developing a message store interface along the way.

When you're done, you'll be ready to contribute to microservices-based projects.

In ebook or in print.