Devlico.Us
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @devlicious

Tim Barcz

Why use nails when a screw is the more reversible choice?


The Tortoise and the Hare

image 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.


Published Aug 11 2008, 12:13 PM by Tim Barcz
Filed under: , ,

Comments

Peter said:

Wonderful analogy, I'm going to try that one out at a presentation for my customers and colleagues later this week.

So unless you've copyrighted the analogy, I'm going to shamelessly steal it =)

# August 12, 2008 3:50 AM

Tim Barcz said:

@Peter

Please, by all means use whatever bits and pieces you need.  

Tim

# August 12, 2008 7:07 AM

Peter said:

Tim: Thanks. However, I realized something when I drew my own diagram based on yours. Maybe the y-axis should be "Productivity" instead of "Effort"? And you could show how the bursts of productivity reach to lower and lower levels for the hare until finally hitting bottom, while the tortoise has a pretty much constant pace for a longer time. Maybe I'm confusing the words here, but isn't the effort constant and pretty much equal between unit testers and non-unit testers? Isn't it how much less productive you become when the system becomes a "big ball of mud" that should be the point?
# August 12, 2008 10:00 AM

Tim Barcz said:

@Peter

By "effort" I mean "difficulty".  Another, possibly better term would be "cost of change".  That in order to change something it costs a lot where cost could be developer hours which translates to time which translates to money.  You last sentence touches on that point nicely.

Does that help?

Oh...and unit testers work much harder than non-unit testers...:-)

# August 12, 2008 10:47 AM

Code Monkey Labs said:

General The Tortoise And The Hare : Tim Barcz has a must-read post comparing enterprise development to the fable of the tortoise and the hare. As someone who's been dealing with this sort of cycle for the last few years, I couldn't agree more. Diligent

# August 15, 2008 3:30 PM

Tim Barcz said:

In church last week we were talking about evolution when the term "Irreducible Complexity"

# September 2, 2008 10:48 AM

Community Blogs said:

In church last week we were talking about evolution when the term "Irreducible Complexity"

# September 2, 2008 11:02 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add
Check out Devlicio.us!

Our Sponsors

Red-Gate!

Proudly Partnered With