Test Driven Development is a thinking tool

Yesterday, I wrote that Writing is a form of Thinking.

On the other hand, we are taught the way to write is

  1. Come up with an outline
  2. Flesh out the details

It rarely works that way because as we are fleshing out the details, we will get new insights and we restructure the content. The outline is dynamic, and changes as we go. The two steps are intertwined, simultaneous even.

This brings me to software development, where for long we have tried breaking it into phases: Design ➡️Development ➡️Testing.

But in reality it doesn't happen this way. When we actually write the code, we realise an insight that changes the design. Writing a test clarifies our thinking on the requirement - which in turn leads us to restructuring the code.

This is why test~driven~development is so useful. TDD is a tool for developers to clarify and restructure their code as they go along in an easy way. I rather think about TDD as a thinking tool, rather than a coding one.