Those of you who know me in real life know that I’m a runner. Since 2006 I’ve run 6 marathons and one double marathon. While I run frequently, I’ve never been particularly fast. Last year, that started to change.
On Wednesdays I run with my friend Kai who is a 2:45 marathoner. During one of our runs last year we were talking about an upcoming race and how different his goal time was from my goal time. I mentioned that I had thought about trying to qualify for the Boston Marathon at one point, but gave up because I just wasn’t fast enough. (To run the Boston Marathon, you have to run a previous marathon in a certain amount of time. For men my age, that time is 3:10 which is quite fast, about a 7:15 mile pace.) Kai told me in no uncertain terms that I was being stupid. He wasn’t naturally faster than me, he just worked hard to get faster. For the rest of our 15 mile run we talked about his training and what I needed to do to get faster.
His advice was so simple I figured that it couldn’t possibly work. He told me to focus on improving every time I run. To not be content to just go out and put in the distance, but to instead go out with a specific goal and to focus on improving. Over the course of the next six months I put this into practice. I did speed workouts on Mondays and ran a little harder on long run days. I didn’t increase my mileage by much, but I did work harder during each workout.
The results were incredible. At the Chicago Marathon in 2011 I ran more than 10 minutes faster than my previous time. Six weeks later I took 10 minutes off my Chicago time at the Philadelphia Marathon. Just by focusing on working harder during my runs I was able to make significant improvements without spending any more time running.
This got me thinking. I’ve been writing software for 15 years and I like to think I’m pretty good at it. I had spent the last 3 years working on a project and I was starting to feel some pain. Some of the code I wrote was hard to change. Some of it had subtle bugs that were hard to fix. A lot of it was hard to test in isolation. I wondered if I could become a better programmer not by devoting more hours to practice, but just by being more intentional about my work.
Over the last five months, I’ve put this idea into practice. I spend more time talking about the design of code with my coworkers. We talk about different ways of building components and the tradeoffs involved. I agonize over naming. I make sure the majority of my code can be tested quickly and in isolation. I even throw away code when I just don’t like it. You would think this focus would have slowed me down. In fact, I’m completing features faster than I have in the past. It turns out that the extra time I spend making sure my code is written well is less than the amount of time I save by having easier to change and easier to test code.
It took me a chance conversation in another part of my life to realize that the way to become a better programmer isn’t just to have more years of experience, or to spend every waking hour coding. All it takes is to work hard at getting better during your working hours.