Some weeks I finish work on a Friday and I struggle to think what I’ve achieved through the week, I’ve worked everyday for 8 hours but somehow all my effort hasn’t converted to results.
Recently I haven’t been having this problem and it’s mainly down to Test Driven Development.
I’ve been writing unit tests for my code for quite some time, but I’d write them after I’d written code, Test Driven Development never seemed like a great idea to me because I reasoned; how can you test code that you haven’t written yet?
The benefits cited for Test Driven Development seem to focus on the improvements in code quality but I think it’s strange that you don’t hear more about the time you can save when allowing your tests to to take the wheel and drive your code to completion.
I noticed very quickly that starting from a test actually made me think more clearly about how I would use my code in the real world. It made it more apparent what my code needed to do, what properties and methods were required and what classes could be ditched because they were not needed to meet the business requirement.
My completed tests also provided me with a metric that measured my productivity, and as my old marketing lecturer used to say “If you can’t measure it, you can’t improve it”. Now at the end of my working week it is plain to see exactly what I’ve done and I have the tests to prove it.
If you haven’t tried Test driven Development I’d advise you put your reservations aside and give it a try, not only will your code become cleaner and more concise, you’ll actually be able to spend less time coding and more time living, surely that’s a goal that everyone can aspire too.