Endurance coding

Jogging in winter by Wojciech Gajda @iStockphoto

You know what the user interface looks like. You know what needs to be coded. You can even see it in your mind. But you’re stalling. Why?

Because there’s a lot of boring code to be typed out.

This isn’t standard code that can be created by code generators. This isn’t code that involve sophisticated algorithms. This isn’t code that require meetings with other developers, managers and users.

It’s just tedious. And there’s a lot of them. And it’s boring the heck out of you.

Taking the bore out of boredom

Focus on milestones. Small ones. Like completing that one function that has to be copied and pasted and hand-altered for customisation (my bind datagrid functions are a case in point…).

Completing milestones, even seemingly insignificant ones, boost morale and the sense of achievement. This allows you to take on the next boring code task. And the next. And the next…

Moving with the rhythm

I like playing Gran Turismo on the PlayStation. I’m not into cars, really. Constantly tinkering with gear ratios doesn’t make any sense to me. Despite being barely able to tell the difference between a front wheel drive and a back wheel drive, I still like the game.

There’s this endurance race course type. It’s long. It’s like 30 laps or something. The tracks take anywhere between half an hour to 2.5 hours.

And when I’m on the endurance course, I’m just mindlessly ploughing the asphalt, swerving around curves, speeding past a tree here and there. After a few laps, the curves become familiar, and I drop into a lull, rhythmically tapping the controller to brake a little here or turn a little there. That’s when I need to jerk my senses back into alert mode.

When you’re coding dull and boring things, you tend to lower your alertness, and that’s when bugs make their way into your code. So how do you stay alert? Move with the rhythm.

If you hand type those code as much as I do, you’ll probably get into a rhythm or beat when you type certain swatches of code (mine’s the string.Empty code phrase). Particularly if you’ve got Intellisense or autocompletion facilities in your IDE. Add tapping your feet to the music, and you’ve got a surefire way of remaining engaged in your code.

It’s not a sprint

Remember, it’s a long journey when you’ve got lots of boring code to churn out. The trick isn’t to wear yourself out by bludgeoning through the code and hope that you’ll finally reach the end. Because you’ll never make it. Usually. Maybe. Or if you’re lucky.

What you need is to slowly build up a coding momentum. Once you’ve got a big enough momentum, inertia will take most of the bore out of the chore. You might take a little more time starting, but it’s the end results that count.

Remember, you’re in an endurance race. Your only opponent is yourself.