Skip to content

Yoyo Code
MatyΓ‘Ε‘ Racek's blog

Ergonomic tips from over-full-time programmer

Over past few years, I spent significant part of my time programming. I can't remember who said this, but the quote was something like "if you want to be a good programmer, you have to be comfortable sitting in front of a computer for long periods of time". That's really what it is. There's no way around that. If you want to be good, you need practice and this is the only way to get it. On top of that, I actually love doing it, so naturally I program a lot in my free time.

But sitting in front of a computer for long periods of time is not exactly the healthiest thing for the body, so here are a few tips for what helped me to actually survive that. They are pretty subjective, but I hope sharing what works for me helps some people to find their optimal setup.

1. Get a standing desk πŸ”—

More specifically, get a desk with adjustable height, so you can sit or stand however you want. I am not even super strict with how I use it. I generally just move it up or down based on how I feel. Sometimes I spend the majority of my work day standing, sometimes I sit all day. Also, when my feet start to hurt, but I still want to maintain the standing posture, I kneel on a chair.

I recommend experimenting with different heights and postures. Generally, you don't want to spend too much time in a single position, changing any parameter even slightly can help if something doesn't feel good.

2. Get a good keyboard πŸ”—

This is a QOL improvement that pays big if you type a lot (and programmers do). I feel like I can't accurately describe why is it better, you have to try it out for a while. It's a lot about what you feel when you type. Good keyboards give you a good tactile feedback which makes them more predictable and effective to work with. This effect seems tiny, but it compounds over millions of keystrokes.

There's also something good about deep keyboards (i.e. not laptop keyboards) that makes them feel better. Writing on a laptop wears out my fingers quicker and doesn't feel as good. Laptop keyboard is suboptimal in other ways, too, I feel like I can't ever rest my hands properly, and I have to hold them in a bit elevated, uncomfortable position.

3. Setup shortcuts or learn Vim πŸ”—

This is related to the previous point and much more important. Good keyboard isn't enough. How you type is also significant.

Programming is very heavy on what I'd call "structural editing". You spend less time typing sentences, but more time moving text around, navigating and using special actions in the IDE. This activity is usually done with some shortcut and very often uses special keys that are not in optimal position on the keyboard. Most common ones are arrows, Home/End, Page Up / Page Down, BackSpace, Delete and modifier keys like Ctrl and Shift. Programming is also heavy on special symbols, which are not in optimal positions, too.

Arrows are by far the biggest problem. Many actions I commonly perform are just a single arrow keystroke. This means that you have to move your right hand to arrow keys and back a lot. Now, Vim enthusiasts will tell you that this is what modal editing is all about. If you learn it, you'll spend the vast majority of your time in the middle of the keyboard and many of your actions will be more efficient.

But Vim is also complicated and time-consuming to learn, so I went for a lazy solution and bought a keyboard with all this built in. I bought Ducky One Two Mini SF, a small keyboard with arrow keys, which also has arrows under fn+IJKL, together with some other useful keys, like Home or End. I've remapped Fn key to Caps-lock, so I could easily press it with my left pinky. It took a while to get used to this setup but was worth a lot, even though some shortcuts became more complicated. One good thing about this keyboard is that everything is done in hardware, so you don't need to mess around with key mapping on every computer you use, you just plug the keyboard in and everything works.

To illustrate the point and show how important this is - this keyboard's connector recently broke, so I switched to a TKL without this mapping. It only took a day of using this (classic) setup, and I already started to feel pain in my right hand. I looked for a solution and found out about AutoHotKey, which I used to set the shortcuts in the OS, which was a surprisingly pleasant experience. I could easily set even better shortcuts than I had before on Ducky. My hand pain went away after just a few hours. I couldn't find a good way to do that on Linux though.

A note on these shortcuts - it's ok if you don't use these all the time. I still use regular arrows and other special keys. Even just reducing how often you move your hand a bit can have a big impact.

Generally, if you move your hand, it should be worth it, you should spend at least some time there and not move back immediately. It's often better to do something with a complicated combination of shortcuts instead of reaching for arrows or mouse.

Related points

  • use a good keyboard mapping. This depends on your native language, but Czech keyboard is not very good for programming for example
  • learn shortcuts in other programs, IDEs and especially in the browser. If you find a way to not use mouse, you'll be happy

4. Ergonomic chairs don't really work πŸ”—

Over the past 5 years, I haven't used a special chair at my home setup. Not only that, I actually found that special chairs seems to make the ergonomics worse. When I started working at my current job, I was going to the office every day and used some cool ergonomic chairs we have there. After few months, I developed a pretty bad back pain, and I couldn't even sit for few days. It went away after I gave it a rest and started using simpler office chair. Then covid hit, and I was back home on simple wooden chair anyway.

At the moment, I use a cheap wooden chair from IKEA with a chair pad, and I haven't had a problem, yet. Needless to say I don't just sit, I also kneel on it, stand up and generally change positions often. Whenever I visit office for more days in a row, I start to feel my back a bit again. Usually it's enough to just stay home for a while, but kneeling on a bean bag to avoid sitting helps, too.

5. Big monitor and big text πŸ”—

A lot of the ergonomics is just about minimizing stress on certain parts of your body that you use a lot. With monitor, it's certainly good to have a big one or multiple ones. You don't want to lean down to look at your laptop's tiny screen. If you use two monitors, make sure to set them up in a way that your default and most common position is looking forward, neither left nor right. Looking sideways for long periods of time is problematic, and you want to avoid it as much as you can.

I also recommend setting your font sizes big and zoom on websites. It might seem pointless if you can read the text already, but it has implications on how you move your body and where you build stress - especially neck and back. If you lean closer to screen often, that's a big red flag. Also, your eyes and brain has to work harder to resolve smaller text. That's just wasting energy you could otherwise put into something more meaningful.

Obligatory note about brightness and blue light: I recommend always setting your monitor to the least brightness you can tolerate without squinting or leaning forward (balance it with the previous point), that'll be easier on your eyes. You also want the screen to fade to red in the evening - some computers do that automatically, I use f.lux. Again, I recommend bumping up the redness as high as you can tolerate, I certainly feel it's more pleasant to use computer in the evening that way.

6. Good shoes πŸ”—

If you use a standing desk, it's good to invest in a good shoes, especially if your floor is hard. I used to have problems with heel pain, and It went away after I bought special shoes, which were adjusted for my feet.

7. Hand exercises πŸ”—

I recommend finding some preventive exercises for your hands. I guess googling "carpal tunnel exercises" is enough, because "carpal tunnel" became a synonym for bunch of similar hand problems. I often use exercises presented in a video by Jamie from Healthy software developer, they feel pretty good. I do them semi regularly when it crosses my mind or when I start sensing a problem.

8. It's individual πŸ”—

A lot of things in this document are just my experiences that stem from how I work and may not apply to everybody. At my office, there's around 15 people at the moment and everybody has a different setup. Some people use single monitor, some people use two, some people have one monitor above laptop, some people have two side by side, some people use external keyboard, some people use laptop one, some people use wrist rest, some don't (I don't). Some people use vertical mouse, some don't.

I think this is just because our bodies are complicated and ergonomics is a complex optimization problem with a lot of variables. I have to work this way, because I really spend huge amount of time in front of a computer. Some people spend free time doing sports, which I'd expect to help with a lot of potential issues, so maybe they don't have to spend so much time worrying about this. I play yoyo in my free time, which might help my wrists and fingers in some way etc.

Lot of it is a kinda magic and works in unexpected ways. You may think you have a back problem, but it actually stems from your hands. You'll have to experiment to find out what's optimal for you.

Discussion: r/programming

This is my AutoHotkey setting:

CapsLock & j::Left
CapsLock & k::Down
CapsLock & i::Up
CapsLock & l::Right

CapsLock & u::Home
CapsLock & o::End

CapsLock & b::Backspace
CapsLock & d::Delete

CapsLock & m::PgDn
CapsLock & p::PgUp

CapsLock & 1::F1
CapsLock & 2::F2
CapsLock & 3::F3
CapsLock & 4::F4
CapsLock & 5::F5
CapsLock & 6::F6
CapsLock & 7::F7
CapsLock & 8::F8
CapsLock & 9::F9

CapsLock & 0::F10

CapsLock & =::F12
CapsLock & -::F11