There was a surprising amount of discussion on Hacker News today on whether or not underscores are stupid, with suggestions ranging from changing key bindings to using the Dvorak layout.

Here’s an alternative (although possibly slightly drastic) solution - get a Japanese keyboard:

JIS Keyboard

I find the layout incredibly efficient for writing Ruby code (and to a lesser extent for other languages), and I’ve been using it for nearly 10 years now. Some of the pros:

  • The Control key is in a far more comfortable position below the Tab key, where caps lock would be on a traditional keyboard (you can map caps-lock to Control on OSX in System Preferences if you want to try this out).
  • Shift-free underscore (second from the right on the fifth row).
  • Shift-free colon (third from the right on the fourth row).
  • Shift-free at-symbol (third from the right on the third row).

JIS Keyboard Zoom

Obviously where there are pros we’re going to get a few cons:

  • Shift is required for single quotes.
  • Shift is required for the equals-sign.
  • You need to type ALT-yen-mark to get a proper backslash. Fun fact - it took me 2 months to figure this out. I had the wikipedia backslash article bookmarked so I could copy/paste the character in the rare cases where the yen-mark didn’t work as a backslash - I kid you not.

Given the limitations above, the million yen question is does this save us any keystrokes? Note that the percentages below are only relative to these 2 sets of 3 characters, and don’t represent the total percentage of keystrokes saved.


In the code base of my current (rails) project, the frequencies of these characters are:

By using the Japanese layout, I’ve saved 19,275 modifier keystrokes on :_@, but cost myself 12,662 modifiers on ‘=\ over the life of the project - not a spectacular saving but not bad.


Contrary to what I was expecting, the last PHP project I worked on had similar savings (despite using a camel-case coding standard):

Here we’ve saved 203,203 modifier keystrokes on :_@ but lost 97,953 on ‘=\ (note that this code was all written before PHP namespacing was around, so there would be a higher backslash-modifier cost in modern PHP).

Both these projects include HTML and Camel-cased Javascript, and use underscores in CSS classes and IDs. They also both use SASS, which probably bumps up the colon count a little.

Plain English

Using the Enron sent email corpus (available for download here) to calculate the frequency distribution for plain English emails, we get a far less impressive saving:

Is it worth it?

Probably not :) No doubt any gain that you get from switching layouts will be cancelled out (at least at first) by the effort required to get used to the new layout. That said, it’s still QWERTY at heart so it’s a lot less drastic than switching to something like Dvorak.

If Ruby is your thing the Japanese layout definitely feels more natural, and if typing the underscore character enrages you to the point where you have to write an article about it then it’s certainly worth considering :)