The Mechanics of Programming 29 comments

posted Friday, July 6, 2007 by topfunky

The Mechanics of Programming

One of the dirty secrets of computer programming is Repetitive Stress Injury. It affects a surprisingly large percentage of people (even prominent Rails developers!), but few talk about it.

I experienced about a year of intense, dull pain at the end of my college years that went away after 6 months of self (and dotcom) induced unemployment. I’m still not exactly sure what I did to solve the problem, but I have learned a few things that have helped me since then.

Much of the medical advice I received was generic and vague. It might work for the average office worker, but a fulltime computer programmer has different needs. Developers also have more options if they are willing to experiment with some drastic changes.

Summary: Pay attention to your body. Build a comfortable workstation for yourself. Stretch. Learn Dvorak if you can commit a month to it. Type softly.

DISCLAIMER: This is not medical advice.

Pay Attention to Your Body

We don’t think of typing as a physical experience. Pushing a few tiny keys barely seems like work! But it is when you do it thousands of times.

One’s first reaction is usually to deny and plow forward. “Surely those small pains will soon disappear on their own!” Instead, trust your body and listen to it. It knows more than you do.

One of the easiest and best things you can do for yourself is to stretch your arms. Reach them out like airplane wings and point your fingers at the sky with your palms facing away from you. For extra credit, rotate your hands backward so your fingers are pointing behind you.

You can do this while seated, so you don’t even have to get up from your chair.

Years ago I also tried more exotic treatments such as acupuncture and therapeutic massage, but I’ve done as well with just basic stretching.

Comfortable Workstation

Obtaining a comfortable workstation is an iterative process. You can’t just run out and buy the first chair, desk, keyboard, or mouse that has an “ergonomic” label on it. I’ve tried a few different combinations and have arrived at a setup that works well for me.

Many developers use laptops exclusively. Here’s a tip: Buy a cheap ($300) 20” Dell monitor and use it instead of your laptop’s monitor. You’ll be able to run at a higher resolution and you can adjust the monitor’s height to a more comfortable level.

I use a desk from Anthro (console unit). Most parts can be bolted at your choice of height. The keyboard platter moves up to about 4 feet high on demand (I do most of my voiceovers and podcasts standing). I also tried the Biomorph for a while but it was too wobbly for my taste.

My monitors are on movable arms from Ergotron (although current iMacs are unfortunately not VESA-mountable).

It’s not crucial that everything be adjustable on demand. You might do well enough by finding a comfortable height and using hardware that bolts to that height permanently. However, adjustable equipment gives you the option of standing or sitting on demand.

Keyboards and Mice

After trying many keyboards, I’ve settled on the TypeMatrix. I love the feel of a laptop keyboard and wanted something that had light key pressure. I’m not opposed to exotic solutions, and I actually appreciate the extra enter and delete key in the middle of the keyboard. I rock a model without any labeling, but you can buy one with the standard QWERTY letters printed on.

The important thing for me is the nipples. Ten of the keys have a physical dot in the middle that gives your fingers something to hunt for without requiring visual confirmation. I haven’t found any other keyboard that provides so much useful feedback.

Previously I used the Microsoft Natural for a few years. Eventually, I got tired of the key pressure needed to depress the keys. The TypeMatrix is surprisingly comfortable to me even though it isn’t split like most natural keyboards.

I’ve never tried the Kinesis, but have heard good reviews. I used a split keyboard that mounted separately on the arms of the chair but it wasn’t very comfortable in the long run.

I tried a few exotic mice, like the 3M Renaissance Mouse and a foot-driven one. I returned to the standard Microsoft optical mouse.

Having a workflow that doesn’t require much mousing is a big deal. I’ve setup a ton of TextMate snippets and use other macros to keep me from touching the mouse unless absolutely necessary. It ends up being faster, too.

Technique

Here’s a free tip: Type softly. Sometimes I don’t realize how hard I’m hammering my fingers on the keys. You may have to intentionally train yourself to press more lightly.

Take breaks. It’s hard to remember, but it will give your mind a break, too.

Dvorak

This section may be controversial, so I’ll keep it short. I went cold turkey to the Dvorak keyboard layout about a year and a half ago. I’ve never regretted it and my hands are much more comfortable because of it. The layout of the keys means that one’s hands travel a shorter distance when reaching for the keys.

My recommendation is to go cold turkey and type nothing but Dvorak for a month. Tape a printout of the keys on your monitor and use that as a reference. After a few days you’ll feel like quitting altogether. After a week or two you’ll start to feel a bit more confident, but your mind will still be in Qwerty mode. If you can stick with it until week 4, you’ll be home free.

If you’re on Windows it’s a little bit tricky since every application can have its own layout. The TypeMatrix keyboard can be flipped to Dvorak mode which makes things easier (but it isn’t necessary that you buy a special keyboard to learn it).

I’ll close with a word from Miles Forrest

I stuck with it, and happy that I did. My fingers do a whole lot less travelling than with Qwerty, and it just feels more comfortable. Even some things I miss like having CUT, COPY, PASTE grouped aren’t a big deal anymore, and I’m starting to get muscle memory back in programs like vi.

I’m glad my hands were starting to hurt under QWERTY, otherwise I wouldn’t have stuck with learning Dvorak. One thing I’d recommend to people who want to learn it, just tape a picture of the layout on your monitor (I had one on my MBP) and don’t switch the keys around—you’re not supposed to look anyhow.

29 comments

Leave a response

  • I’d like to echo the importance of using the keyboard for as much as you can and eschewing the rodent. That (combined with a comfortable keyboard at a good position) will get you huge benefits.

    Obviously you want to be extremely adept with the key bindings of your editor, but most people don’t realize you can also improve your efficiency by avoiding mouse usage in other areas as well. Get a window manager that either manages windows for you or lets you manage them from the keyboard. (If you have to reach for your mouse to move a window, you fail.) Using Conkeror will let you do pretty much everything from the keyboard—the author doesn’t even have a mouse.

    When you do have to use a pointing device, (they are nicer for graphics editing and certain limited tasks) try to think of what will reduce movement. Trackpoints (pointer nipples) are great in that regard as long as you can get one that has enough give to it. Trackballs also require less arm movement than conventional mice and offer more accuracy than a trackpoint, especially with a large ball.

    Just some thoughts. This has helped a lot for me, but if you spend your day on different tasks, obviously it won’t do as well.

  • Gravatar icon MikeInAZ

    Hi,

    You’ll also want to check out AntiRSI, a free OS X program, that automatically reminds you to take breaks at your own set intervals.

    http://tech.inhelsinki.nl/antirsi/

    Win/Linux alternative: http://www.workrave.org/welcome/

  • Gravatar icon nap

    I use a kinesis and love it. Highly, highly recommended. It will take some getting used to, but after a month or so you’ll be more comfortable and typing faster to boot. The only bitch of it is having to switch back to a normal keyboard when I’m on the road.

    I’m also a big fan of anthro stuff. I’ve had mine for just over a year now. Developers seem to be cheap people by nature much of the time. I know many talented folks that continue to use $15 flat keyboards on a folding table from Walmart. I mean, I’m a frugal person by nature too (I bought the anthro off a friend moving x-country, my mbp laptop is a refurb, etc) but c’mon! You have to treat yourself right once in a while :-).

  • Out of curiosity what is your WPM with Dvorak now? And is that your WPM with standard writing, or with coding?

    Kevin

  • I also switched to Dvorak many years ago and my WPM is basically the same as it was with QWERTY, maybe slightly faster. The key thing is the comfort: my hands and wrists are way happier now with Dvorak.

    I used Kinesis for over a year, but my thumbs started hurting. I currently use the MS Natural Ergonomic 4000. Be careful when you buy it though: MS has recently ruined them! I had to buy another one recently, and the spacebar was terrible. The spacebar used to be way springier.

    I also recommend the Humanscale keyboard arm and Freedom chair.

    I blogged more about Dvorak, chairs, keyboards, etc here last year…

    Peter

  • Having worked with a woman who had surgery on both wrists and still had to wear lace-up wrist braces, I’m a bit cautious about ergonomics related to keyboarding.

    I use an Evoluent Vertical mouse ($70-$80), a Gold Touch Ergonomic keyboard ($130), and a Koosh ball ($3).

    The Vertical mouse has five buttons and a thumb wheel for scrolling. It’s a wired, optical mouse. To hold it, rest the outside edge of your hand on the desktop, thumb on top and let your fingers curl in toward your palm (like you’re about to shake someone’s hand). The problem with mice comes if you drop your wrist from the mouse to your forearm. With the Evoluent, you can’t drop your wrist. Although I’m right-handed, I’ve always used a mouse with my left hand. When I bought my Vertical, I paid about $10 more for the left hand version, but I think with the latest model left and right are the same price.

    The Gold Touch splits vertically and rotates horizontally, then can be locked in place where you think it feels best. Hold your hands in front of you as if you’re holding a basketball, that’s about the hand position that I use with the Gold Touch. I thought about getting a Kinesis, but wanted an adjustable keyboard.

    And, for when I pause while keyboarding, I have a Koosh ball that I toss from hand-to-hand to exercise my fingers and wrists in different ranges of motion.

    BTW: You may want to check the height of your monitors relative to your eyes, while you are in sitting position. In the photo, they seem high to me.

  • That keyboard looks awesome. I love how you can change the skin from qwerty to dvorak… I’m going to have to get one :)

    The only time I ever suffered from RSI symptoms was when I was in a high stress job, coupled with a less than optimal keyboard. I bought a GoldTouch and that made a bit of difference, but changing jobs made the most difference in the long run.

    I also found it hard to get advice, and there’s a lot of rhetoric about RSI being psychosomatic and while I don’t fully agree with this I do think that in some cases it can be a contributing factor.

    One question: do you use that Belkin PS2->USB connector? If so, do you have a problem with it where it will ‘reset’ your keyboard and mouse every so often? (i.e. lights go on and off, unresponsive, if you got keys down while it resets the keyboard goes bonkers).

    And on another note, I absolutely hate the Apple Pro keyboards. They’re RSI factories like no other. But I love the laptop (in particular, the Macbook Pro/Powerbook) keyboards. I’m using the lowest of the range MS wired keyboard / mouse and they’re great, but they uglify my iMac setup :)

  • Gravatar icon Daniel Lucraft

    That keyboard looks awesome, but there seems to be one big problem with it. My hand strain comes from hitting control sequences in emacs, but on the TypeMatrix the control key is even further away in the bottom left corner.

    If you’re a big textmate user you must have the same problem. How do you fix it on the TypeMatrix?

    (On my qwerty I remapped CAPS to CTRL which helped quite a bit, but on the TypeMatrix even that doesn’t seem to be possible since the caps is in such a weird place).

    I’d really like to know how you deal with this because I’d like to put the TypeMatrix on my shopping list if it’s possible.

  • Gravatar icon Yaroslav Markin

    This is the best blog post I have ever seen since I learned how to use an RSS aggregator.

    Thank you Geoffrey.

  • I second the recommendation for a trackball. My pain went away almost immediatly. This vertical mouse looks like it delivers the same benefits.

    And, well, while it works for you: Your monitor is situated way too high. It should be a bit lower than your eyes. At least if you are sitting correctly (and are not lying in your chair). I loce the chairs from Hag (www.hag.no), while I’m not sure if they are available in the U.S.

    Bye egghat.

  • For those outside of Mac world, there is nice Open Source program to remind about breaks when typing: Workrave:

    Workrave

  • AFAIk Dvorak was optimally designed for standard English typing, it seems less obvious that it will be much of an improvement over qwerty when doing programming in ruby (let alone C) where numbers, brackets and operators are a lot more common than in English prose, as well as oft-repeating keywords like def and class.

    (Then again, I read that qwerty was designed to be as slow as possible, so pretty much anything should be an improvement.)

    Personally I’m waiting for someone to construct an optimal ruby keyboard layout! qwerty’s “a-s-d” could be replaced with “d-e-f” or “a-s-d-f” with “c-l-a-s” ;D

  • Not to be a contrarian but I prefer a real keyboard :)

    http://www.clickykeyboard.com/

    You get a lot of feedback from what you are typing. Additionally, there is a lot less fat fingering since this is a bigger keyboard. I found my WPM increase drastically.

    The issue with the Dvorak seems to be unlearning years or decades of memory to where the keys are. I don’t think a months time is enough to unlearn the years of training.

  • That keyboard is mad! ;-) I’d also recommend an Aeron chair if you can afford it. It’s a big up-front cost, but it’s built to last and comes with a guarantee to match. Most importantly, it really does work.

  • when i switched to dvorak, i was still a windows user. for you windows ppl, definitely check out DVAssist.

    http://www.clabs.org/blogki/index.cgi?page=/ComputersAndTechnology/DvAssist

    The main feature i used was the “always on top” keyboard layout you can display on your screen. Its great for weeks 1 and 2. :] It also has quick layout switching, but thats built into windows now. (DVAssist is from 1998)

  • Gravatar icon Justin

    For those who chose the Dvorak route and miss copy, cut, and paste; Try Ctrl-Ins=Copy, Shift-Ins=Paste, Shift-Del=Cut… It works sometimes (depending on the application).

  • Gravatar icon willhf

    Cool stuff! I recently switched to a keyboard layout name Colemak (www.colemak.com). One of the advantages to Colemak is that common keyboard shortcut keys ‘zxcv’ are kept in the same place, which makes switching from qwerty much easier.

  • Gravatar icon Tom

    Ryan Allen: I use the TypeMatrix with the Belkin connector, and yes, I get that problem every so often.

  • Gravatar icon Yudi

    I have rearranged my MBP to Dvroak layout.

    http://www.flickr.com/photos/8192269@N07/748525368/

  • I highly recommend Rollermouse -

    http://www.contourdesign.com/rollermouse/

    I’ve got a classic that I use all the time. It took a little getting used to, but not much. Pretty much eliminated my wrist problems.

  • Also, for plain text I try to use speech recognition rather than the keyboard. It doesn’t work well with jargon-laden text, but for normal English it’s great. I’m using the built-in software with Vista, and used to use Dragon. I’d say I get somewhere between 50-75% of my (bad, and non-dvorak) typing speed.

  • cool! i’ve been wanting to go dvorak for a long time… text to speech is cool. i hope http://www.apple.com/macosx/leopard/ has good support

  • Gravatar icon topfunky

    For anyone using non-standard keyboards with a Mac, you’ll benefit by swapping the Option and Command keys in the Keyboard & Mouse system control panel. This usually turns the key labeled “Start” into a Command key.

    On the TypeMatrix, this has the added benefit of making the bottom left key with the dot into a Command key (a more natural location for me). The far right dotted key (under the red DELETE) is also a Command key now, too. And, the key to the left of the spacebar switches between active apps.

  • Gravatar icon drew

    Is tidy_table documented somewhere?

  • Gravatar icon Cyx

    Yes, dvorak was way worth it for me too. I don’t get any forearm muscle pains any more.

    Btw, any of you guys know how to navigate the alert messages in a mac (i.e. Save Dont Save Cancel)

    Command + First letter used to work in firefox but now it doesn’t.

  • Gravatar icon topfunky

    @Cyx: Esc will do “Cancel”, and Command-D is usually “Don’t Save”. Sometimes I can hit tab and cycle through the buttons, then hit space to select (but I can’t reproduce this now for some reason).

  • Gravatar icon topfunky

    @drew: Docs are published here now:

    http://seattlerb.rubyforge.org/tidy_table/

    Or see the rdoc in the code itself.

  • So, you have had some time with the TypeMatrix keyboard, how do you like it?

    I am looking for a new keyboard after realizing I type too hard. I like the looks of the TypeMatrix except for the location of the Enter and Backspace keys.

  • Dvorak -> cold turkey. Exactly! This is how I did it too. 20 years on querty and 5 months now on Dvorak. I don’t regret it at all and my typing is back to it’s previous speed.

Your Comment

Nuby on Rails

Geoffrey Grosenbach / Ruby / Code / Graphics / Design / Rails / Merb / Javascript / CSS

Manufactured with

Subscribe

Subscribe (RSS)