PuppyCoding

Friendly Python & AI tutorials for beginner & intermediate programmers.


The Most Important Coding Habits

Two friendly old monsters with walking sticks.

I’ve just learnt the hard way that the most important coding habits are not readability, consistency, organisation or any of the things that make our code better. No, the most important habits are those that enable us to enjoy this craft for years and decades to come.

I’m writing this lying down, recovering from a slipped disc (spinal disc herniation) that’s a result of far too long hunched over a keyboard. I’ve tried to take steps to improve my posture over the last few years but alas, I let good habits slip and I’ve been taught a lesson.

MRI scan of my spine showing a spinal disc hernia, bulging out and pushing against the spinal nerve.

A slipped disc doesn’t actually mean a spinal disc has been dislodged. It’s actually when a disc, usually near the base of the spine, develops a bulge which sticks out and presses against the spinal nerve. It’s as painful as it sounds (and then some!), and also causes tingling and pain in the legs too. At times it’s made me unable to move and unable to sleep. Recovery takes weeks or months, although surgery is also an option.

It could happen to any of us if we develop unhealthy habits when programming, with the strain on our backs building up over time. And so, fellow keyboard warrior, here are some steps I encourage you to take to avoid this pain.

Daily stretches

According to my osteopath*, sitting for long periods of time had led to my stomach and thigh muscles being relatively unused, and therefore unable to assist my back in supporting my body, putting it under extra strain. Although strength-building exercises would be best, just doing daily central and lower body stretches would have a positive effect. The muscles would be more supple and more able to help support the body.

Photo of a man outside on a terrace, stretching forward in a yoga pose.  Photo by Scott Broome on Unsplash.

You don’t have to suddenly become a yoga fanatic (although you can if you want!). Just regular stretches in the morning or after a hot bath in the evening, when the body is relaxed, should make a big difference.

Take regular breaks

This is so simple but so important – at least once an hour get up and take a short walk or some other non-screen activity. Not only is this an easy way to look after your body, I’ve often found that it helps with coding too. So many times I’ve been stuck on a problem, done something completely different, and then come back to the problem with an idea of something new to try.

I feel like this is something we all know we should do, but often hard to put into practice. Time to make it a habit!

Don’t code late at night

I think we’re all guilty of this, sometimes even turning it into a boast – “I pulled an all-nighter!” Surely it’s time we change this attitude. Our code is worse, even harmful, when we’re really tired, and we naturally concentrate less on our posture leading to being hunched over the keyboard for hours. Please set a time past which you will switch off, mentally and physically, and be strict with it.

Improve your coding environment

I have a laptop stand and ergonomic chair, both of which make sitting at my desk much more comfortable, but even with those I still ending up suffering with back pain. I’ve heard so many recommendations for a standing desk that at last, I’m making the switch.

Currently I just have a temporary setup of a small table on top of my desk, but already I can feel I move around more than when I sit, without really feeling more tired. It also naturally leads to taking more breaks so it’s a 2-in-1 habit!

I don’t know why it took me so long to realise the importance of this and all the other habits, and I wish I’d fixed my ways earlier. Now I’ve paid the price but hopefully it’s not too late for you, especially if you’re in the early stages of your career.

Please learn from my mistakes and enjoy many happy years of healthy coding!


* I previously wrote “chiropractor” here but have changed it to “osteopath”. I live in Japan so I didn’t know the English name but the place I go to is a 接骨院, which I think is probably an osteopath but I’m not 100% sure.

** There’s an interesting discussion of this post on Hacker News, with more tips and suggestions by commenters.



7 responses to “The Most Important Coding Habits”

  1. […] この記事はHackerNewsに掲載された下記の記事およびそれに対するHackerNews上のコメントを元に作成されています。The Most Important Coding Habits […]

    Like

  2. […] Important Coding Habits by Daniel Davis […]

    Like

  3. […] Important Coding Habits by Daniel Davis […]

    Like

Leave a comment