TDD and Negative Splits

Taken by http://www.flickr.com/photos/matt_alt/As a sometimes cross country and track runner, I was taught and quickly learned that the best way to run any longer distance is to do the second half faster than the first half. In distance running, we call this negative splits. Those of you who have run negative splits know how different it feels from “positive splits” where you run the second half slower. When you finish a race in which you run negative splits you generally finish more quickly, feel much better, and are excited about running the next race. When you finish a race with positive splits you feel wiped out, beaten down (by everyone who managed to do negative splits), and uninspired. Although there may be and probably are physical reasons for these results, much of it is definitely psychological. If you spend the first half of the race conserving energy and then the second half passing people, it doesn’t matter that much that you spent the first half further back than many others. As you begin passing people the psychology of lots of small wins kicks in and really makes you feel good.

But negative splits are hard to do. When the gun goes off your adrenaline is already racing and you want to win. You don’t want people to pass you left and right while you run conservatively. Even when you know through experience the benefits of negative splits, it’s easy to get caught up in the moment and start too quickly. Or it may just be that the race leaders seem so far ahead of you that you have to go faster or lose all hope of remaining competitive. Pride may drive you to run faster earlier. Or it might be a justified fear that by trying to run negative splits you actually start off too slowly and never make up the time.

In the past couple months as I’ve started practicing test driven development of a new feature that I own, I’ve felt very much like I’m in the first half of a distance race. I know that I’m progressing slower than I have in the past, if you simply measure my progress in writing code that will ship. I can feel that I’m taking longer to do what I’m doing. However, I also feel like I’ll be able to complete the feature faster, which mostly means that the bug tail will be much shorter. Looking at the code I’ve written vs what I’ve done in the past I know there is an improvement. The daily process of writing tests, and then writing code that makes them succeed is as addictive as passing people in a race and keeps me excited about the end result, even if I’m moving slower by some measures. At the same time, I feel like a better developer, I’m able to make changes more quickly, and I’m more excited about my work.

0 Responses to “TDD and Negative Splits”


Comments are currently closed.