You want your code to be healthy and bug-free. How about starting with yourself?
Let's face it: Programmers, on average, don't have the healthiest of lifestyles. We sit too much, often in one position for hours. When we get absorbed in figuring out problems we forget to eat, then fuel up with pizza and too much caffeine. We work irregular hours, sleeping when a face-plant on the keyboard makes it mandatory. And anyone who's attended a developer's conference will have noticed that rarely does one see such a gathering of pasty-faced, overweight individuals. Mostly it’s the guys, but hard-core female developers can be just as neglectful of their health.
It's no wonder we're sometimes achy and cranky and generally unhealthy.
The Healthy Programmer, by Joe Kutner, isn't your average get-fit book. It's subtitled, "Get Fit, Feel Better, and Keep Coding," and the book couches all of its advice in terms familiar to developers. Kutner is a programmer who has felt the pain, and has done serious research into ways to turn blobby code slugs into agile code monkeys. He emphasizes in his foreword that everything in the book, unless otherwise stated, is backed up by peer-reviewed published research and is accepted by the medical community.
"Health is a nebulous thing that involves many aspects of life. Thus it's important to clearly define it for the purpose of this book," Kutner writes in his preface. "A healthy person is at low risk for developing lifestyle-induced diseases. Furthermore, a healthy person should be relatively pain-free."
And with that, he invites us to refactor our health. (I told you he used programming language.)
But before refactoring, as any good coder knows, you have to unit test. The first chapter of the book asks pointed questions (Is it uncomfortable to bend over and tie your shoes?) and presents Kutner's goal-based approach. If you like, you can download an iPhone app to help track your progress towards your goals from the book's website.
Then we move on, to Fermat's Last Theorem. Why? Because when Andrew Wiles was proving that theorem (working on it for eight long years), and he suffered a mental block, he took a walk. A little exercise helped Wiles get his brain back in gear. And, says Kutner, it can help us too. He suggests an experiment we can do to prove it to ourselves.
And on it goes, adding simple goals for us in each chapter – we end up with 19 – ranging from Goal 1: "Change one habit" (maybe bypassing that mid-afternoon candy fix) through Goal 19: "Set new goals." Each goal is accompanied by strategies for success, all couched in programming terms.
We get sensible advice, divided tidily into chapters on topics we can relate to: sitting versus standing (standing desks are trendy, but are they good for you? Maybe not), agile dieting, preventing headaches and eye strain, preventing back pain, preventing wrist pain, and developer-friendly ways to exercise.
Did you know that solving tricky puzzles activates the same reward mechanisms in your brain that eating does? Kutner suggests that you can take advantage of this to satisfy cravings for unneeded food. He provides an "eating mindfully" flowchart. It helps us figure out whether we really need that snack, or are just bored, nibbling out of habit, or eating because the bowl of candy is sitting there, begging to be consumed. And then he recommends easy ways to cut back on calories without feeling deprived; eliminating one soft drink per day is enough to start the pounds slipping off.
Kutner uses similar common-sense approaches to eyestrain, back pain, and sore wrists. For the back, he offers a series of tests (the Kraus-Weber series) to help you check out how fit the various muscle groups that support you actually are. Then he walks through the basic anatomy, and suggests exercises to strengthen those supporting muscles as well as a workstation setup to optimize posture. Wrists get similar treatment in another chapter.
Of course, you have to remember to do all of these things, and for that, he offers the Pomodoro Technique. With it, you set a timer for 25 minutes, dive into a task, and stop when the timer goes off, regardless of whether the task is complete. Take a five-minute break to stretch and move around. Rinse and repeat. Kutner notes that the technique works well with methodologies like Scrum, Agile and spiral, which all use time-boxed iterations.
All of the advice in the book is wrapped around stories that developers can relate to. We hear about how the founder of Autodesk learned to manage his weight, what 17th-century harpsichord players have in common with today's programmers, and how a technique used by actors and musicians can combat developers’ carpal tunnel syndrome. The book itself is well-written and well-designed, and, possibly most importantly, well annotated so we know from whence the advice comes.
And probably the best bit of advice comes at the end: Being healthy should be fun.
Buy a copy. You'll thank yourself.
The Healthy Programmer, by Joe Kutner. The Pragmatic Bookshelf, 2013. ISBN: 978-1-93778-531-4. $36.00.