Since we’re starting a new year and health & fitness are on the mind, here’s how I attempt to combat the negative affects of the sedentary lifestyle of the professional programmer.
I came across the Cornell University Ergonomics Department’s research summarization on Sitting and Standing at Work a few years ago. The article starts off by describing some scary correlations between glucose metabolism, heart disease and kidney disease with sitting for prolonged periods of time, then goes to say that regular aerobic exercise does not seem to counteract some of the negative affects.
The recommended activity is to take a short, 2 minute break every 20-30 minutes and move around. The theory is that taking a short walk or doing other light exercise increases circulation and encourages the metabolism to burn blood sugar instead of storing it as fat.
Since I work in a c#/.net shop, my workstation is a Windows PC, so I found a program called Workrave. It also runs on Linux, but if you’re a Mac user there are programs that do similar things too.
Workrave is designed primarily to prevent a different ailment: Repetitive Strain Injury (RSI). To that end, the program aims to remind the user to take “micro breaks” every 10-15 minutes to let the wrists and fingers rest or give them a nice stretch. Workrave also has an optional daily limit feature that will tell you when you’ve been at the keyboard for too many hours in a day, and politely ask you to drop what you’re doing until tomorrow.
Personally, I haven’t had much trouble with wrist pain, so I don’t use the micro-break and daily limit features. But Workrave also has a “Rest break” timer that you can customize to remind you to take a break.
For my purposes, Workrave is really just a glorified countdown timer, but it has a pretty friendly notification system that gets your attention but doesn’t completely interrupt your work when the time comes due. It also has a nice option to postpone or skip a rest break when it comes due.
One important caveat about Workrave: since it was created to prevent RSI, the program only runs the timer by default when it detects keyboard and mouse activity. So if you spend lots of time reading code, browsing, reading e-mail and the like, Workrave will go significantly longer than the time limit you set before asking you to take a break. This is easily fixed however by enabling the “Reading mode” option, which causes the timer to run continuously regardless of whether you are reading or typing and mousing.
Workrave also has built-in suggested exercises you can try during breaks that help relax your eyes, stretch the neck and things like that. These are pretty useful, but it’s paramount to get out of the chair and get your blood flowing. I largely ignore the built in exercises and just go for a short walk.
The trouble you inevitably run into is that getting little reminders to take breaks can be distracting. Programmers, like anybody else, are most productive when they achieve that state of mind known as flow, where attention to the task at hand is so focused that even the passing of time fades away. The notification UI is subtle enough that I find I can often postpone a rest break without losing much focus, but the trouble is that the whole point is to get up and move away from the computer at least every 30 minutes.
When I really get into the zone, I still struggle sometimes with tearing myself away, and I end up hitting postpone repeatedly. But whenever I do take a break I find that I can come back and settle back into my work quickly without having to warm up again. Plenty has been written about the negative affects of “context switching” between various tasks, but taking a short break actually lets you keep noodling on the same task while you take a brief walk around. Sometimes taking your eyes off the code lets you think about a problem from a different angle. I’ve actually found it beneficial to take these breaks while debugging or troubleshooting a tough problem that I’ve been stuck on.
Sitting all day is bad for you. Working out after work doesn’t change that. Twice an hour, get up and move around. It’s good for your health and productivity.