Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Follow publication

TDD is not learned, it is practiced

Javier Lopez
Dev Genius
Published in
7 min readNov 18, 2022

--

TDD (Test Driven Development) are four steps (the first is to think), but those steps are thought to follow the “Make it work, make it right, make it fast” approach. It is a way to defer design to the Last Responsible Moment, refactor is allowed by Tests and you always have tests in TDD. But to be effective in these steps, we have to stop doing some of the things we have taught to do.

Pixabay

TDD seems to be a simple thing, in fact it is a process of 4 steps:

  • Think
  • Create a test that fails
  • Make the test pass with the minimum possible code
  • Refactor

Repeat this once and again, the problem is that in my case this goes against everything I learned to do.
During all my years studying, I had been taught to follow a process that usually means think very hard on something until you find the solution. Create a model in your mind that helps you to fix the problem at all.
I’m not complaining about the approach, the point of the school is usually teaching you something very specific to transfer some preexisting knowledge.
So they give you some tools and with enough thinking you are able to solve the problem (hours perhaps days, no more than some weeks).
At that scale the model works, small problems can be thought deeply before doing something, but at big problems are not a question of deep thinking. You need another thing, you need experimentation.

When I tried to apply this model to big problems, I needed a lot of cognitive load, but also I don’t usually had all the information, I had to discover it.
So in this context of big uncertainty, it was very hard trying to solve a problem just in my mind.
Is this meaning that we cannot solve big problems, no, that’s not true, but sometimes it is much more effective to use experimentation instead of deep thinking.
In science, you call this the scientific method, when coding you can call this TDD.

Why to do TDD?

First, before doing TDD I usually wrote tests after my code was written, and I also learned about mocks, perhaps my learnings on TDD were…

--

--

Published in Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Written by Javier Lopez

Principal Software Consultant at Thoughtworks

Responses (4)

Write a response