Programming isn't all that good for your health. Part of the problem is that you spend a lot of time sitting in one place - often hunched and tense. The bigger problem is that programming uses up a lot of motivational energy. There are many ways to get exercise and live healthily if you have extra motivation - but most programmers I know use up all of their motivation in their work. The last thing I want to do in the middle of running my own software company is to go prepare for a marathon - I already spend my life in a tough slog against exhaustion in pursuit of a distant goal.
However, just sitting at a desk all day and eating pizza and drinking too much coffee isn't a good plan for living well or long. Over the years, I've come up with a few simple things that have helped me stay relatively healthy. <h3>Snack Wisely</h3> I've found that when I'm concentrating I like to be eating or drinking something at the same time. When I started programming from home, I used to make a 12-cup pot of coffee from espresso beans, and then follow it up over the rest of the day with Coca Cola, supplemented with Doritos. When I was feeling virtuous, I would switch to Smartfood Popcorn. I'm really glad that I never took up smoking, because I <em>know</em> that I would have a terrible two-pack-a-day habit. A few years ago, I discovered a key thing: <strong>it doesn't actually matter what I'm snacking on</strong>. My brain just needs <em>some</em> idle fidgeting and consumption to work more smoothly, <strong>but it doesn't have to be junk food</strong>. So, now I always have a pint glass of water (just tap water) on my desk, with some lemon concentrate for flavour. I still have coffee in the morning, but I use a French press, which not only makes tastier coffee, but less of it. For snacks, I've switched to carrot sticks - I'll eat a small bag of them every day. This doesn't mean that I've cut the tasty things out of my life - I still eat cheeseburgers and drink beer and wine and all of that - but I don't eat unhealthy snacks, especially when I'm not paying attention anyhow. <h3>Use Your Pauses</h3>As computer users, we often have <a href="http://eviljaymz.com/files/whypeopleseemtohavefreetime.png" target="new">little bits of downtime</a> in our work - waiting for uploads or downloads, compiling, running large database processes, or whatever. I used to just switch to Reddit or Slashdot or whatever in those pauses - and then get lost down a rat-hole of distraction. I've recently found a new thing for those distractions: <strong>push-ups</strong>. It takes less than a minute to do a few pushups - not enough time to be a big distraction in your day, and it's not like you're doing something else while you're downloading. The trick is to bypass your motivation. Getting up in the morning and saying "today I'm going to do 50 push-ups" is a setup for failure. I need my coffee first, and then usually there's a phone call with some kind of emergency, and then there's a lunch meeting, and I get caught up in programming - and then when I do have time, I'm too mentally exhausted to commit to that extra exertion. But there are always brief pauses in the middle of the day - and they're enough of a lull for me to do a few push-ups. Try to do an extra push-up each time. I started with 10 just a few weeks ago, and now I can do 50 without too much trouble.
Your mileage may vary if you work in an office with other people, but it's great if you have some privacy.
<h3>Walk</h3>If you can, walk as much as possible. I know people who have lost an astounding amount of weight simply by walking to work in the morning. This won't work so well if you live way out in the suburbs and work downtown (or vice-versa, like I used to do), but seriously consider walking if you have a short trip to make. Also, with traffic the way that it is in many cities, walking may not be much slower than driving. Simply getting out of the house/office and walking around the block or the office complex can clear your head and help your programming. Longer walks can be a great way to tune back into the real world - something I often need to do if I've been working too hard. If you'd rather avoid reality, an iPod full of Audiobooks and podcasts can turn long walks into learning and enrichment opportunities. <h3>More Intense Options</h3> If you decide you would like to pursue a more rigourous health regimen, there are all sorts of health clubs, exercise plans, sports, and teams you can look into - unfortunately, most of them are filled with the kinds of people who used to beat up computer nerds in school. There <em>are</em> some nerd-friendly options out there. I haven't had the chance to try it myself, but I've heard a lot about the <a href="http://en.wikipedia.org/wiki/5BX" target="new">5BX</a> program. This was designed by the Royal Canadian Air Force in the 1950s, and was even used as the basis for a book called <a href="http://en.wikipedia.org/wiki/The_Hacker%27s_Diet" target="new">The Hacker's Diet</a>. 5BX starts very simply, and has a strict sequence of increasing difficulty. You start with ridiculously easy exercises and aren't allowed to skip ahead, so from day one you're feeling superior rather than discouraged. It takes a few minutes a day and doesn't require any fancy equipment. Another option would be look into a martial art, like Kung Fu. Yoga is very popular these days, but Kung Fu is actually quite similar, with the addition that you learn self-defence. Deep down, doesn't every programmer want to be Neo from the Matrix? What's great with Kung Fu is that you learn forms and exercises that you can do at home by yourself without any fancy or expensive gear. The gear you do need is more appealing, too - who wouldn't prefer to have a sword around the house than a rowing machine? The trick is to find a place that isn't full of <a href="http://www.youtube.com/watch?v=PKmUsVeKp1o" target="new">jerks</a>. I've been going to <a href="http://www.wuxingmartialarts.com/" target="new">Wu Xing Martial Arts</a> for the last few years (yes that's me in the "Focus" picture in the slideshow), although with work and travel I haven't been able to attend as many classes as I would like. The sessions are supportive and friendly, and they have a holistic approach to mind and body - rather than just a 'boot to the head' approach. My balance and flexibility improved tremendously in just a few weeks (although they were pretty lousy to start with), and it has certainly helped my general health and fitness. Most schools will let you sit in on a class or two to get the feel of the place - find one that's inviting and supportive.
But you don't need to make a dramatic and difficult change to your lifestyle to improve your health. Just a few small steps - so small that your laziness won't even notice them - can make a big difference.