DEV Community

Discussion on: A note from a TDD zealot

Collapse
 
vdedodev profile image
Vincent Dedo

The problem with TDD is that there are slightly different ways it's described and to those trying to figure out how to do it, it makes no sense. I've tried writing tests before code and it almost never works, so I've given up on having TDD as my go to approach.

Collapse
 
mbjelac profile image
Marko Bjelac • Edited

Writing tests before the code its just one of the steps. In many ways the third step and the mostly un-mentioned zeroth step are crucial to a working TDD process:

  • 0 - think - what is it that I want?
  • 1 - write a failing test
  • 2 - make it pass
  • 3 - refactor - how to make this code (and tests!) more readable?

The trouble is, IMHO both steps 0 & 3 require a solid knowledge of software design - SOLID, DRY, YAGNI, 4 rules of simple design, etc. Having a grasp of those before trying TDD is a big help (like it was in my case).