Click here to Skip to main content
12,823,984 members (42,612 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


2 bookmarked
Posted 27 Feb 2013

Staying Healthy == Better Code...

, 27 Feb 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
This article aims to highlight links between good coding, more productive development, and some best practices for the most sophisticated of systems, our bodies.

As developers, on any given day we may put on the hat of many different roles such as the requirements gatherer, interpreter, problem solver, designer, coder, user, tester and many more...

This article aims to highlight links between good coding, more productive development, and some best practices for the most sophisticated of systems, our bodies. I encourage you to comment and suggest other techniques that you have found beneficial also.

Let’s get one thing said before we kick off. I for one have been on projects where caffeine and junk food were absolutely necessary to crank out a big ‘go live’ or update code over a 24hr period that could affect hundreds of thousands of people or involved in a hackathon guerrilla event where commodes were more efficient than using the bathroom J. However, when the dust settles and things are a little more normal and day to day, good health habits can make a big difference to not only help you think more clearly but deal with those high pressure situations when they arise tomorrow.


When I was a kid, I remember a book entitled “You are what you eat”. It’s a phrase that stuck and sometimes makes a difference when I am choosing my lunch.

There is a ton of differing opinions when it comes to diet so here goes mine. “Balance” - that single word gives me complete freedom to eat what I want but at the same time keeps me conscious of what my body needs.

I recently did a 2 week juice diet in an attempt to lose a bit of weight and fill my body with nutrients, enzymes and basically feel more energized. It worked, I lost about 7lbs and genuinely felt better. Now I have that as a plan at least once a year to do something similar.

Drinking plenty of water each day has been proven to increase concentration, something as developers we need a lot of.

Avoiding a big lunch can aid in productivity because needed energy is not spent breaking down food and means you escape the urge to have a nap under your desk.


We have all had the memo or meeting about screen height or keyboard position. I bought a chair last year which forces good posture. If I sit in it for longer than 2 hours, my knees have no feeling J but the point is that switching position and being aware of your sitting position is really important. Our bodies have not been designed for long hours of sitting in the same position so the more you move in between or change position, the better,


On a previous developer role, we were given a reduced membership at a local health club. So once or twice a week, I embarked on having a swim over lunch. Wow what a difference, that complete somewhat forced break really helped me focus better in the afternoon. Swimming is renowned for working many muscles in the body including the lower back which any coder sitting for long periods of time can suffer a bit with.

What about getting to and from work? I was working on a train route for a while and was able to cycle from home to the train and at the other end for a total of about 4 miles. Then at the end of the day, it’s all reversed. I can honestly say it was great. Sure, I got wet a few times but nothing a pair of waterproofs couldn’t solve, but also I enjoyed many sunny mornings and evenings which is surprisingly relaxing before getting home. There is something very satisfying about arriving home after work, knowing that you already did your exercise for the day during normal work hours.

Everyone’s schedule is different and only you know yours. The point is try and make room for something each day which gets your heart pumping a little and produces stress relieving endorphins.

Take a Break

I was one of the world’s worst at just working through problems without taking a break. However by taking a break, and by that I mean leaving your desk, going for a walk outside the office for some minutes, even when under pressure can make a massive difference to your whole approach to a problem.

Sleep On It

Sometimes, you take a break and you still spend the rest of the day on that, and I quote “Impossible Problem” and can’t see the wood for the trees. Don’t despair, sometimes, you need to put the problem down, shift your attention to something a little lighter and just sleep on it. If I had a pound for the times I woke the next morning with a solution to a problem or sometimes in the middle of the night, I would be a rich man. The brain is very powerful and sometimes we just need to let its thing.

Don’t Take Yourself Too Seriously

Some studies suggest that some seemingly healthy lifestyles can lead to stress. My take is that some can worry so much about health and body matters that they basically fail to enjoy life along the way, causing more anxiety and stress than the efforts to avoid it. Don’t be afraid to laugh at yourself once in a while. As developers, we can sometimes get a bit proud of our code and not take criticism easily. Remember that every system ever written contains bugs. If another developer points out something in a code review, embrace it, learn and let go. Life is too short for perfection. Find something to make you chuckle each day, and remember the healing power of laughter.


To develop software well requires a certain amount of discipline. Adding comments, creating unit tests, refactoring, just to mention a few, requires effort on our part. If we train our minds to be disciplined outside of work, it becomes a lot less effort in work to desire that all the planets are aligned and our code and supporting documentation is kept up to date. Having said that, creative minds are often not very tidy ones.

As the mind is the most complex of all body parts, it is important to avoid stress outside of work. This allows it to focus and work out complex problems with a lot more ease. My personal observation has been that happy individuals with a good friend or family supporting network, tend to be able to focus better and find solutions to problems faster.


  • Eat well
  • Sit well
  • Take breaks
  • Exercise
  • Drink plenty of water
  • Laugh
  • Get enough sleep


I am certainly not a health freak, nor a fitness fanatic but I do believe that if you take a balanced approach and most importantly give it some thought, you can definitely increase your productivity and well being which ends up making you more successful and productive as developers.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Carl Randall
Architect AssemblySoft
United Kingdom United Kingdom
Carl Randall is the founder of where he offers freelancing services. He has specialized in Information Technology solutions for over 20 years. Specializing in full life-cycle development projects for both enterprise-wide systems, desktop applications and Internet based solutions. Carl is a Microsoft Cloud expert.

Carl has been involved in .Net since it's inception and is currently a Microsoft Certified Professional Developer (Enterprise).

When not coding and designing, Carl enjoys playing table tennis, tennis, sailing and spending time by the beach - when the british weather permits Wink | ;)

You may also be interested in...

Comments and Discussions

Questionapp racial for article Pin
sudhakarareddyjavvaji8-Mar-13 6:18
membersudhakarareddyjavvaji8-Mar-13 6:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170308.1 | Last Updated 27 Feb 2013
Article Copyright 2013 by Carl Randall
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid