CodeProject
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 where 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.
Diet
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 energised. 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 nap under
your desk.
Posture
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.
Below is a chair I have in my office which you are supposed to switch over to for a while each day, it claims to force good posture. It looks a little like a torture device but it does seem to work. The Knees go in first with the bottom on the top part, guiding the back in a vertical angle. The main benefits focus around the lower back which tends to take a lot of strain during a day of sitting.
Exercise
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.
You may have heard of young developer named Santiago Gonzalez on YouTube where he says "
I Dream In Code". Well Santiago, we have news for you, we all do if we just let go and let our brain do it's thing as we sleep.
Don’t take yourself too seriously
Some studies suggest that some seemingly healthy lifestyle’s
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 dev. 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.
Mind
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.
Checklist
·
Eat Well
·
Sit Well
·
Take Breaks
·
Exercise
·
Drink plenty of water
·
Laugh
·
Get enough sleep
Conclusion
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 wellbeing which ends up making you
more successful and productive as developers.
For some more musings, checkout my blazor.net and azure blog here carlrandall.net