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.
I'm really glad that I never took up smoking, because I know that I would have a terrible two-pack-a-day habit.
A few years ago, I discovered a key thing: it doesn't actually matter what I'm snacking on. My brain just needs some idle fidgeting and consumption to work more smoothly, but it doesn't have to be junk food.
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.
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.
I haven't had the chance to try it myself, but I've heard a lot about the 5BX program. This was designed by the Royal Canadian Air Force in the 1950s, and was even used as the basis for a book called The Hacker's Diet.
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 jerks. I've been going to Wu Xing Martial Arts 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.