I practice TDD. There are a lot of reasons for this. Many of my reasons didn’t even become clear to me until after I had been doing TDD for awhile. Most people will tell you the same. It seems there are untold benefits that you have to experience for yourself. Just try it and see. If you are told about the benefits up-front, you will simply never experience for yourself how dramatic of an effect TDD can have.
But there is one reason to do TDD that I find more compelling than any other, and that reason still makes sense even if you only think about it.
The reason is simply that it is boring, manual, and time-consuming to implement code without TDD. Who among us has ever coded something up without testing it out? No one. The very first thing you do after writing your first code is to run it. Of course something simple has been missed, and you go back and fix it, and then you go back and run it again, and then you see how it can be better, and then you go back and implement the new idea, then you go back and run it, and etc. etc. etc. That’s how you code!
Now: most people who object to TDD would rather keep doing this. They don’t realize that this is nearly the cycle TDD encourages, just with one major difference! The difference being, that you don’t run your code manually. Instead, you run your code with some test code.
Code can run other code faster than a person. Even you. The test code does the same thing you would be doing, but relieves you of all the tedious shit like compiling, deploying, waiting for the application to come up, navigating to where your code is actually running, typing stuff into input boxes, pressing buttons, and all that other horrifying sleep-inducing robotic stuff.
Instead just press a button. Tests are running. A few moments later, you know if your code is good. Now write the next test, implement the next thing, and run the test. Simple. Way more efficient. Far less time-consuming. Much easier to focus on the feature you’re implementing rather than the environment and infrastructure around it.
So give it a try. It’s a much more zen-like development process. TDD is better than that other way you’re used to doing things. It’s more fun!