Filed under: TDD, — Tags: Test-Driven Development — Thomas Sundberg — 2019-10-31
I had a conversation with a developer this spring about Test-Driven Development, TDD. We both agreed that it is a good habit.
I asked why he doesn't do more TDD than he does. He is not using TDD as his default mode when writing code. His answer fascinated me.
I don't know if it should be a rest api or something else.
If that is the conditions you work under, I can absolutely understand if TDD is the least of your problem. I can definitely understand if you don't use TDD in that context.
There are few problems here that will make it really hard to do TDD
You don't know your scope. Therefore it is hard to know where to start and it is impossible to know when to stop. Which acceptance test that should pass so you can define the work done? With an unlimited scope, you can't define the acceptance criteria.
TDD without an idea of where you should end up is a random walk with no goal. It might be a better idea to just sit tight and not do anything until you have a better understanding of where you want to end up.
Building something without a goal is a bad idea. Always make sure you know where you should end up. Even if you don't have all the details, make sure you have some kind of idea.
I'm thinking of a quote from Alice in Wonderland:
“Would you tell me, please, which way I ought to go from here?"
"That depends a good deal on where you want to get to."
"I don't much care where –"
"Then it doesn't matter which way you go.”
― Lewis Carroll, Alice in Wonderland
Without a goal, don't start walking. You will not end up in a good place. Without an idea of where you want to end up, don't start implementing a program.