I started using TDD a couple of months ago and what strikes me now is how much more fun it is to develop in this radically new way. There are several reasons for this.
A common frustration when developing in the traditional way is that the progress is not immediately visible. This is particularly true in larger projects. You write a lot of code before you get something that is working and can be demonstrated. With TDD, every new passing test is a clear sign of a small step forward.
Another common cause for frustration and dissatisfaction for a professional developer is that many times you are not confident that your code is working as expected. If you apply TDD, allmost 100% of your code will be covered by tests and that will make you confident that the code is doing the right thing.
In the past I have sometimes suffered from “code writer’s block” when I’m trying so hard to get the design right from the beginning that I couldn’t produce any code at all. With TDD you don’t have to get it right from the start. The tests allows you to try out different designs and easily refactor the code without breaking it.
Every now and then I try to write some code for a hobby project, but I rarely got more than an hour or two free for coding at home. A TDD roundtrip of “red – green – refactor” typically takes less than two hours to complete, which means that even though I have very limited time I can still make som progress by adding at least one passing test every time I get a chance to write some code at home.
By applying TDD you will get greater job satisfaction as a developer. You will get feedback serveral times a day that you are making progress. You will be more confident that the code you are delivering is working as expected and you will find it easier to experiment with the design, thus giving you more freedom.
Feedback, confidence and freedom are factors that will make you enjoy your profession even more. Don’t miss an oppurtunity to have more fun at work and with your hobby projects – jump on the TDD bandwagon now!!