Skip to main content

The medical reason I use tabs instead of spaces

Oh the old war between tabs and spaces. The battles that have been fought and won and lost. The friendships born and destroyed. The style guides that have been created that demand one or the other. The insane auto-indentation calculation systems that mix tabs and spaces in the same document. The difference in pay that can be achieved...and then debunked.

But enough waxing poetic. I used to be a spaces guy for many, many, many years and even went so far as to tout "two-space tabs" as "the best indentation format". All of my code consistently used spaces and I loved it. But then I switched to tabs and haven't looked back. There's a simple reason to use tabs that universally beats out all other reasons:

Carpal Tunnel Syndrome

Years ago, I got carpal tunnel not once, but twice in a fairly short period of intense coding. I made the realization that I needed to cut back the number of times I was hitting the spacebar. So even "two-space tabs" wasn't good enough. I needed to save my wrists from repetitive keystrokes so I made a switch to tabs. The hardest part of the switch was mental - keystroke memory. Every text editor out there can show tabs as two or four space indents, so tabs works out fine as far as horizontal screen real estate usage goes. And the number of keystrokes I made was cut by 50% in my case. If you are insane and hit the spacebar 8 times to indent each line, that makes you many, many times more likely to develop carpal tunnel!

It is also important to note that I turn off auto-indent in all of my text editors (wherever possible). Auto-indent has never worked "right" in any text editor that I've ever used and has never failed to drive me up the wall. I've wasted more hours and more keystrokes wrestling with auto-indentation systems than I care to think about. I prefer refined control over the layout of any document even if it means pressing a few extra keys here or there. Plus there's column-editing mode for bulk indentation modifications where I need to modify the indentation of 200+ lines of code at one time.

The switch to tabs also resulted in fewer bytes of storage on disk. The savings can be quite significant when talking about content delivered to a web browser and can even eliminate the need to minify code. However, that's only a side benefit of using tabs.

It's possible that whenever the medical industry catches wind of this that insurance premiums might go up for those who use spaces or, like me, turn off auto-indent. So that's something to consider too. Sure, you might make more money using spaces (or not) but then end up paying out more out-of-pocket in premiums or on various medical procedures.

Comments