Run for better code

23 minute read Modified:

Run for better code

You’re a programmer, software craftsman, full-stack developer, software engineer. But regardless of the titles dangling from your Twitter bio, if you want to greatly improve the quality of your code and indeed the quality of your life, there’s one more title you should consider tacking on there: “Runner”…

But first, to set the stage for the article to come, enjoy this riveting vignette, entitled, The Fast and the Farcical. (skip vignette)


The Fast and the Farcical!

Rows of implacable street lamps bathe the pavement below in a dull yellow glow, intent on their nightly effort to scrub the oil and grit from the dark surface. A fruitless endeavor of course, but there they stand, stoic stationary soldiers of the night. The street-racing Miami nightlife isn’t grateful for the light - it’s just an intrinsic part of the sculpted concrete and asphalt landscape, but they’re drawn to it nonetheless. The light glistens as it alights and dances across chrome and spotless tempered glass. It even takes a moment to console the long skeins of polyester fibers in their struggle to maintain cohesion around those oversized biceps. It seems the only place the light can’t penetrate, the last stronghold, are those eyes. The dull, listless eyes. Eyes that have seen too much, and too little.

Cars on the street at night
Photo by Yuan Thirdy on Unsplash

A light breeze takes hold of a few discarded wrappers and crumpled fliers, sending them skidding across the pavement. The air is sultry, and smells like salty gasoline. One car after another roars to life as the driver races the engine in neutral, then leads his car to the starting line.

The scene abruptly cuts to you, and the slight manly grimace that escapes the normally implacable facade of your ruggedly boyish face - you just cut yourself shaving. The only sound is the buzz of the fluorescent shop lights hanging from the rafters. The air is stifling, and smells like oil and metal. And oddly enough - grass.

It’s an hour before the race, your big night, and you can’t quite shake those pre-race jitters. You grab a clean-enough rag to stop the bleeding, then set about absent-mindedly returning an assortment of greasy wrenches to their homes in a big red toolbox. Tonight would be the night. With these new modifications you would have the edge you needed to take the competition. And maybe, just maybe, the heart of Dolores Fuentes, though currently her affections lay elsewhere, in the pocket of Sir Revselot, the street racing kingpin. The thought of her sets your pulse racing; the mere thought of him causes your eyes to squint, ever so slightly.

You run your calloused fingers over the recent addition to your ride: A fully integrated nitrous oxide delivery system. At a key moment in the race, a simple but decisive press of a button would release a burst of the frigid gas into the motor’s compression chambers, pushing the stock pistons to new limits, and you - across the finish line. The customizations don’t stop there: Drifting tires, a short shifter, racing clutch… A hint of a smile flits across your face as you absent-mindedly double-check the tightness of various nuts and bolts; though a life of foster care and street living had taught you some humility, it wasn’t a stretch to say you were one of the best drivers in world. You toss the rag in a garbage can, slide into the driver’s seat, and turn the key in the ignition. The once still garage is suddenly alive and trembling in resonance with your anticipation. You shake your head. Sir Revselot, heh. That’s probably not even his real name.

Your lacquered green custom paint job glistens and preens as proudly as a parrot as you round the corner and approach the starting line, gloved hands deftly guiding your craft as it trundles and purrs down the road. You catch sight of Dolores standing near Revselot’s prisine WRX and swallow hard. Most of the cars are already at the starting line and Dolores is holding a black and white checkered flag loosely in one of her slender hands. Your eyes meet and the arid landscape of your face cracks into a tight smile. She looks at you and sighs audibly, shaking her head in exasperation.

Revselot sees you too. You pull up next to his car, your fists white-knuckled on the steering wheel. In one smooth movement he puts his transmission in neutral and engages the parking brake. Lowering his sunglasses slightly, he turns toward you in his seat and looks straight into your eyes, his clear blue eyes piercing. “Bro”, he says, firmly, but not unkindly. “Bro, ¿Cuándo vas a aprender, amigo?” He pauses, gathering his thoughts. “These races, they’re not for you. Es que no son pa’ ti, chico.” Sunglasses? Seriously?

“Listen, Sir Revslelot”, you start. “If that’s your real name-”

But you’re cut off by one of his band of merry racing men. “Oyes, Farmer Juan! You still inhaling your own nitrous? You know that’s not for human consumption, right Boss?”

By this time a small crowd is gathered around the two vehicles, and everyone roars with laughter. Everyone except you of course, and Dolores. Your jaw clenches and your gaze narrows. Dolores doesn’t laugh, but hints of a smile tug at her mouth, threatening to betray her. Actually, Revselot doesn’t laugh either. “Cállate, chico. If Juan really wants to race, well…” He returns his sunglasses to their perch. “Well then, let’s race! Dolores?”

“Ready!”, Dolores shouts. The line of cars thunder and quiver in place, seeming to paw at the asphalt like young bulls ready to stampede.

“Set!” She raises the checkered flag high above her head. Your heart is in your chest, your left foot firmly on the clutch while you feather the gas with your right foot. Ay Dios mio when is she going to lower that thing! The second seems to last an eternity.

“Go!” The checkered flag lowers with a graceful flourish. Tearing your gaze from Dolores, you dump the clutch, your tires squealing like a cornered mountain lion, leaving a trail of dark rubber on the road behind you, a timeline of the blood, sweat, and tears that brought you this far. This is it, this is it! A fluid motion puts you in second gear… One, one-thousand. The motor screams in agony, in defiance! Third gear… Two, one-thousand… Fourth gear. Seemingly with a mind of its own, your thumb flicks off the switch cover and triumphantly depresses the red NoS switch. You bury the gas pedal so deep in the floor you’ll need to mount a spelunking expedition to retrieve it after the race. The small craft lurches, the front end lifting off the ground, and you hit an adjacent switch, igniting your exhaust. Yeah, that was just for show, but what… a… show! Your world is alive in a flash of fire and sound.

Sir Revselot sees your show, the world in slow motion as he pulls up alongside you in his masterpiece of custom craftsmanship. The cacophony of the race dims far into the background, the only real sound the sound of your own heart beating in your ears, like a war drum, but too slow. Street lamps whiz by, the light dancing a slow motion ballet over the clearcoat of Revselot’s immaculate sports car. The flames from your exhaust reflect hypnotically off his whirling stainless steel rims. The two vehicles ride neck and neck like lathered warhorses in the night, undulating, their shiny manes billowing back in the sultry air. The knight turns to look at you, one hand on his steering wheel, the other no doubt ready to shift, the whole scene playing out again in miniature in the reflection on his dark aviator sunglasses. His mouth twists apologetically for an instant, his head shaking slightly. He shifts to third gear, and time comes careening back to you in full force - the noise, the lights, the smell of burnt rubber.

Ten, one thousand… You see rows of brake lights ahead. The race was over, and you were only half way down the street. You let off the gas and shift to neutral, coasting to a stop on the side of the road. You lay slumped over the steering wheel, your body trembling. The night air carries the distant sound of music to your defeated ears. “We… are the champions, my friends…” The music still playing soulfully in the background, the scene pans slowly to the side of your vehicle. There, emblazoned in green, proud for the all world to see, are the words “John Deere”.

Man walking by a green riding lawn mower
Photo by Christopher Groff on Unsplash

Why programmers should be runners

Ok, so what’s the point of that silly vignette? Let me break it down for you: You are the driver. Or more accurately, your brain is the driver. If all you do is sit around and code all day, your body is the lawnmower. You wouldn’t show up to a street race on a riding lawn mower; you wouldn’t even show up in a stock Corolla. So why do we think it’s okay to show up for work sputtering, backfiring, and blowing smoke out the tailpipe? I mean, many shops do these things called “sprints” - What would happen to you if you literally tried to sprint?

…why do we think it’s okay to show up for work sputtering, backfiring, and blowing smoke out the tailpipe?

I’m going to convince you that you will be a better programmer if you take up running. Then I’ll pass on a few tips for getting out the front door, hopefully without getting injured.

Ladies and gentlemen, start your engines!

Cognitive benefits of running

Why run? For starters, running makes you smarter.

Programming is hard. It is one of the most complex endeavors ever undertaken by man. But that’s why caffeine was invented… Right?

Wrong. Caffeine as a nootropic performance enhancer only goes so far. A shot of nitrous oxide might be the boost an already heavily modified car needs to take the track trophy, but if its engine came from a 5HP lawn-mower…? Not so much.

What you need is to drop a whole new block in your engine compartment - a brand new brain in your cranium. Running has been demonstrated to take what you’ve got and unleash your cognitive potential. (/* Of course it’s possible that many forms of exercise, particularly aerobic exercise, will produce similar results. I don’t know. Perhaps running is easier to study; all you need is a treadmill and some sensors. */) In fact, if running was tried as a cognitive performance enhancer in a court of law, it would be an open-shut case. The evidence has been mounting for decades. Just search Google for the “cognitive benefits of running” and you’ll see what I mean. Consider a few gleanings from those articles, including my own N+1 anecdotal evidence, in the areas of memory, energy, functional intelligence, mood, stress tolerance, and more.

Running down memory lane

The typical software developer has to remember a lot of minutiae. Many have turned to services like Evernote to augment that capricious companion, the human memory. Well running can help bolster that fickle fellow. Studies on runners have shown running to increase the size and density of the anterior hippocampus, a portion of the brain strongly related to memory function. Additionally, there’s an important master protein called estrogen-related receptor gamma (ERRγ) that controls the release of energy to both your muscles and your brain. Studies on mice indicate that running causes your body to produce more ERRγ, so not only do you end up with more endurance for running the rat race, you’re also better at memorizing your way through the maze of new frameworks and poorly documented interfaces.

It’s no surprise then, that subjects in numerous tests showed improvements in spatial memory after participating in a regimen of running. Other studies have demonstrated that running lights up your prefrontal cortex and thus improves working memory. Curiously, the same study showed that weight lifting did nothing to improve working memory.

Myself, I noticed a jump in recall after listening to podcasts and audiobooks while running. Months after listening to an article I was able to recall pertinent details of the article including where I was running when I heard it. Eerie.

Miracle gro for your brain

Running has been shown to increase levels of Brain derived Neurotropic Factor (BDNF). BDNF is part of a class of chemicals called neurotropons, proteins that help cells grow. In this case -> brain cells <- neurons and their synapses! This is good. It’s like miracle gro for your brain.

Ditch the energy drinks - Run for more energy

One of the tenants of Agile, Extreme Programming in particular, is the laudable concept of “energized work”, which rejects programming death marches and all-nighters as inefficient and counterproductive in the long run due to their debilitating effects on mental acuity and physical health, reducing your overall energy output and shackling you to Captain Lethargy. Instead, energized work is supported by a healthy diet, a sustainable pace, and sufficient rest.

Again, numerous studies have linked regular exercise, including running, to a decrease in levels of fatigue, even in people suffering from disease.

I can definitely attest to this. I feel supercharged for about two days after a long run (1 hour plus), even if I don’t run on those days.

Run for better sleep

Some people report sleeping better when they run regularly. This varies from person to person. This is certainly true in my case, though if I run late it can take me awhile to wind down. Interestingly, elite runners typically sleep about 9 hours a night, probably to support their body’s nightly repair work. My guess is you won’t find too many stereotypical night-owl programmers finishing an ultramarathon.

Psychological benefits of running

Even people who can ace a technical interview may still fail to land a job because of the dreaded behavioral questions and -shiver- small talk! Your interviewers realize that yes, you’re brilliant, but no, they’d rather not work with someone of your, shall we say… “character”. Apart from pumping you up and enhancing your “wetware”, a good running program will have positive psychological side effects as well. Consider a few examples.

Run for your mood, not from it

As programmers we spend a lot of time alone in our heads, even if we work in an open plan office. So what’s the work environment like inside your head? Is it full of bubblegum and butterflies, or is it a toxic melancholy base camp for the broken-hearted? And what would your coworkers say about you, Mr. or Mrs. Grouchy-Pants? That is, if they so weren’t terrified?

What’s the work environment like inside your head?

Well, running has been demonstrated to increase dopamine and serotonin levels in the brain, so get out there and run. Maybe you’ll return to your head and find that it’s been remodeled to resemble Candy Land or something. And that’s not just a refactor - it’s a complete rewrite.

Run for greater tolerance to stress

Stress? Programming? Never! :)

Programming itself isn’t generally stress-inducing, but the typical habitats where programmers are found often are. This is so well-known that some of the interview questions (and arguably the entire experience) for programming job interviews revolve around how well you handle stress.

Aerobic exercise in general has been shown to increase tolerance to stress. Given a runner and a non-runner who are both submitted to stress-inducing stimuli of equal value on the “stress-u-out scale(/* Yeah I totally made up the stress-u-out scale */) , the runner will exhibit less signs of stress than his sedentary counterpart. Apparently this isn’t just due to the presence of more “happy hormones” in the brain - regular exercise actually remodels the brain, making it more stress resistant. So beyond a healthy diet of Big Os and programming puzzles, you might consider a few long runs to help calm that pre-interview performance anxiety.

Learn how to pace yourself, Turbo

If there’s one thing that running teaches you, it’s how to pace yourself. New runners typically start out every run way too fast. A mile down the road and they’re out of breath and miserable. Quickly, you must learn: to go fast, you must start slow. Even in races, many records are set by runners running “negative splits”, where their lap time actually decreases for each successive lap, meaning they’re starting slower and speeding up as they close in on the finish line.

Mountain road
Photo by Jeremy Bishop on Unsplash

You’re out running one cool evening with nothing in your head but the steady thrum of your sneakers and the soft rasp of your deep breaths, like a luthier working a new guitar neck with smooth sandpaper. Right then and there, with the sun straining to get one eye over the horizon, to sneak one last gilded peek at the elongated landscape, you’re hit with this epiphany. In life, slower is often faster. Running teaches you how much you can handle, and for how long. Applied to software development, this has profound meaning for the way we work. As mentioned earlier, death marches are not sustainable. You need breaks. You need nourishment, hydration. By learning what you are truly capable of, you can maximize your output and code quality over the long haul, rather than favoring short-term benefits with long-term negative consequences.

Run to like yourself

If you stick with a solid running program and you’re watching your diet, you’re going to shed all those extra slices of pizza you stored away during hours of overtime. You’re going to discover the latent six-pack you had hiding under the lattes. You’ll feel natural energy pulsing through your veins and in your brain, fueled by hoards of newly developed mitochondria. You’ll pat yourself on the back as you set one new personal record after another. You’ll experience the famed “runners high”. You’ll accidentally solve programming problems while out for a long run. You’ll stand up straighter. You’ll lose the insecure posturing, and find self-respect in its place. As you explore the edges of your human limitations, you’ll find humility. So run to like yourself, and you’ll likely find that others like you too.

Running on Haiku Stairs maintain trail at sunset
Photo by Kalen Emsley on Unsplash

You’ll lose the insecure posturing, and find self-respect in its place.

General health benefits of running

Besides boosting your brainpower and sending you to your happy place, the evidence keeps mounting in favor of running as this wonderful elixir of general health and well-being. Here’s a few bullet points for you to chew on.

By running, you…

  • lower your risk of developing dementia by 50%
  • lower your risk of heart disease by up to 50%
  • lower your risk of cancer by 50%
  • lower your blood pressure
  • lower your resting heart rate
  • raise your levels of good cholesterol
  • boost your immune system
  • lower your risk of developing blood clots
  • help prevent diabetes
  • strengthen your lungs
  • increase your bone density
  • strengthen your connective tissue (including your knees)
  • hear better, due to increased blood flow to the ears

How to start running

So you’re convinced. You need to start running, or perhaps run more. Where do you start?

Educate yourself

It’s essential that you take some time to educate yourself a little before you run out the front door. Something like 80% of runners injure themselves every year because of starting too fast, too furious. When you think about it, running is just jumping from one foot to the other for a prolonged period of time. You’ve been sitting comfy in your ergonomic office chair for the last ten years. Imagine if you suddenly got up and jumped in place for two hours, and on one foot. What do you think might happen to your unconditioned bones and connective tissue?

A book I highly recommend is Build Your Running Body. There may be better books out there, but this one took me from running the occasional 10K to running a marathon in less than 3 months. It covers the whole 9 yards: Your cardiovascular system, energy systems, connective tissue, injury prevention, nutrition, psychological matters, you name it, it’s there. We’re used to rapidly assimilating information; you should be able to read through it in a few days.

Get your gear

Running shoes

Well, first off, unless you want to try barefoot running (/* Barefoot running is a good way to get injured if you’re just starting to run. */) , you’re going to need some good running shoes. I recommend going to a brick-and-mortar store like Jackrabbit Sports where they have treadmills equipped with cameras to analyze your gait and find the right shoe for you. It only costs a few bucks more than you’d pay on Amazon and the service provided is invaluable. I mean, at its heart running is a cheap sport. The only thing you really need is a good pair of shoes. So go ahead and splurge on them. Your feet will be grateful. Actually, so will your achilles, and calves, and shins, and hips - indeed, the whole kinetic chain will thank you for a good pair of running shoes.

Bring your own phone?

If you want to run with your phone for music or GPS tracking, you’ll need a way to hold it that doesn’t drive you crazy or throw off your running gait. If you’re running any kind of distance, you don’t want to be holding your phone in your hand the whole time, and you don’t want to use one of those arm bands; they ever so slightly throw off your center of gravity, more so if you have a hefty phablet. Rather, I recommend an SPI Belt. It holds your phone securely around your waist where it can’t jiggle and bounce.

Running software

Tracking your run

Tracking your run can be interesting, especially if you need help remembering how many miles you’ve run in those shoes. Make sure you don’t start gaming your numbers though. If you get all caught up in the numbers, you’re more likely to get injured. Some decent apps I’ve tried are Runtastic, Nike Run Club, and runkeeper. Of the three of them I find that Nike+ probably provides the most bang for your buck - it’s free.

Pacing yourself

You’ll recall that one of the psychological side-benefits of running is that you learn the importance of pacing yourself. A common newbie mistake is to always run everything at the same pace –> fast. “If I’m not feeling the burn and sweating like that can of cold beer sitting on my deck on the Louisiana bayou, I’m not getting a workout.” That kind of thinking gets you injured. In order to build a better running body, you need to run at a variety of paces, everything from slow long runs, to short sprints up steep hills.

Runby Pace app
Runby Pace app

But everyone is at a different level of fitness. Your Long Run pace might be too fast for me. That’s why I started writing a little app called “Runby Pace”, inspired by the Build Your Running Body book I mentioned earlier. All you need is your current 5 kilometer race time and the type of run you’re planning and it will tell you how fast you should be running per mile. (/* The core logic for Runby Pace is encapsulated in the eponymous open source Ruby gem runby_pace. Check it out on GitHub */)

GPS Watch

Determining whether or not you’re running at the right pace for a given run type can be difficult, especially when you’re just starting out. Some of the run tracker apps mentioned above will announce your pace with each mile, or at preset intervals. Runkeeper can interface with your smartwatch and provide some realtime pace information, but while its pace-per-mile was accurate, I found it the realtime pace to be wildly inaccurate. So I switched to a GPS watch for its superior pacing capabilities.

Solid GPS watches
  • Garmin Forerunner 10
    • Entry level
    • Won’t break the bank
    • Battery: about 5 hours of GPS tracking
    • Manually syncs to Garmin Connect via USB cable
    • Difficult to use for interval training
    • Sometimes slow to get a GPS lock
  • Garmin Forerunner 230
    • Prosumer level
    • Battery: about 11 hours of GPS tracking
    • Automatically syncs to Garmin Connect through your phone
    • Great for interval training
    • No flaky heart rate monitor, which saves you $100 over the 235
    • Activity tracking (steps, sleep)

Bluetooth headset

A Bluetooth headset is great if you want to listen to music, books, or podcasts. Just don’t get run over by a car you can’t hear, and don’t overdo it. Music can “pump you up” and lead you to push yourself harder than you’re ready for. Consider forgoing music for a while until you’re more in tune with your body.

Attributes to consider in a Bluetooth headset
  • Sweat-proof
  • Stays put
  • Decent battery life
    • Not cool when your music cuts out in the middle of a great run
  • Minimizes the “stethoscope effect” (earbuds), where every step sounds like the heartbeat of a blue whale.

Here’s an inexpensive headset that meets these characteristics, though its in-ear design does come with the some of the dreaded stethoscope effect. To avoid it you’ll need to use the smaller set of earbuds, which unfortunately attenuates the punch of the bass somewhat.

Other personal items to consider

  • Fog-resistant Sunglasses with UV protection
  • Hat or visor
  • Sunscreen
  • Shirts/shorts with technical moisture wicking fabrics.
  • Bodyglide anti-chafe balm

Recovery and injury prevention equipment

Conclusion

Why are you still reading this article? Get out there and run for your marbles, mate! Ready? Set? Go! :)

Old green tractor in a field
Photo by Teo Zac on Unsplash