We're all familiar with the Aesop's fable of the tortoise and the hare. In the story, the hare, who is in every way is faster than the tortoise, loses a race to the tortoise. The main principle of the story is that slow and steady wins the race.
In my development I am shooting to be a tortoise, really I am. Read on and let me explain.
A few weeks ago I got some evil glares when I suggested at our .NET user group meeting that in enterprise systems that you don't have time not to test. It's a common hurdle for those new to testing to say, "I don't have time to write tests." Let's face it, we're all busy, that excuse is tired. As an agile and lean practitioner I seek out ways to improve velocity and reduce waste, not take my already busy schedule and cram in another tool for the sake of another tool. While writing tests does slow me down, it brings on tortoise like speed, which I would argue is a good thing. Writing unit tests is one tool that provide me the ability to keep a more consistent velocity over the course of development. Without tests I can surely write things faster, the problem arises as the codebase grows and each new feature or fix takes increasingly more time. Eventually, even simple requests become arduous to implement. Slowly you see your velocity come to a crawl.
It's an insidious cycle that I've seen before and am currently in the throes of; an application is built from scratch implementing everything the business requires. The application is enhanced and bolted on to, until you realize that you could move much faster if you could start from scratch. You make pleas to your boss and explain how much productivity would improve if you could shed the hideous code base. One day he gives in, you rejoice and you make the leap, start from scratch, breathing a sigh of relief at how easy implementing the features are all the while reminiscing about the old framework and how poorly it was written. And now that the application is rewritten from scratch the cycle, unless you were aware of it all the while, starts again.
You see, no one sets out to write crap code. People do the best they can with the knowledge they have. Code, following the second law of thermodynamics, tends towards chaos over time. With unit tests in place I can refactor with more confidence and implement new features without the fear of breaking existing code. If you have the ability to refactor, new code is no longer "bolted on" but rather "grafted in" becoming part of the system. With a solid framework with tests in place you can much better stop the cycle of rewrites. Quickly writing applications that degrade is the way of the hare. Developing purposefully using unit tests causes me to be slow in the short run, but over the life of the application comes out far ahead. In that way, I strive to be the tortoise.
This blog contains the thoughts and discoveries of Tim Barcz, a technologist with a interests in computer programming technologies.