Programmer (vs) Dvorak
Posted by Michał ‘mina86’ Nazarewicz on 30th of May 2021
A few years age I’ve made a decision that had the potential to change the course of history. Had I went a different path, the pl(dvp) layout might have never seen the light of day. But did I make a wise choice? Or had I chosen poorly?
I’m talking of course about the decision to learn Programmer Dvorak rather than a regular Dvorak keyboard layout. The main differences between the two is that in the former digits are entered with Shift key pressed down which allows several punctuation marks often used when programming to be typed without the need to reach for Shift. The hypothesis goes that developers use digits less often thus such design optimises the layout for them.
To test this I’ve grabbed all my git repositories and constructed a histogram of characters used in text files present there. Since letters are on the same position on both layouts in question, only digits and punctuation characters are compared on the histogram:
The graph supports the idea that punctuation is used more often than digits when programming. Keys outside of the number row are for the most part on the same position on regular Dvorak and Programmer Dvorak layouts so shifted and unshifted characters are of main interest. Of those, the first four are non-digits and within the first ten only three are digits.
A quite striking feature of Programmer Dvorak is that it puts digits in a ‘7531902468’ sequence (rather than ordering them). Again, the histogram supports that design decision as well. The two most used digits are zero and one which are accessible with index finger. Traditional sorted ordering puts them in little finger’s column.
A minor difference between the two Dvorak variants is position of the apostrophe and semicolon keys. The data shows that I use double quote quite often. Since I’ve never learned to properly use Shift keys, location used by Programmer Dvorak ends up beneficial for me. After all, pressing Shift with the key right next to it is easier than Shift and the key two rows up.
Lastly, Programmer Dvorak moves plus and equals signs to the number row. On regular Dvorak layout those keys are accessible by stretching right little finger one row up and two columns to the side. It’s hardly a comfortable key to reach. Programmer Dvorak puts caret and at sign there instead. And yes, you’ve guessed it, the data supports that decision: equals and plus are used much more than at sign and caret.†
Different languages use their own syntax and thus the most commonly used characters end up different. Someone writing exclusively in Lisp will wear out their parenthesise much quicker than someone writing in Haskell. Turns out, I write mostly in languages whose syntax is based on C.
|File type||Percentage of lines|
|C or C++||41.53%|
|HTML or XML-based||8.98%|
But I also dabble in Lisp. This brings up a question: is that why I write so many parenthesise? Analysing all files except for
*.el reveal that my using Emacs doesn’t skew the result too much. There is a little bit of shuffling but parenthesise still end up in top five (even though their relative frequency suffers) and first digit (zero) on 12th position.
Looks like my choice was correct. It has been scientifically proven that Programmer Dvorak is better than regular Dvorak. Who knows what catastrophes were averted thanks to me!
Except of course this was hardly scientific and the results should be taken with a grain of salt. After all, looking at the characters in source files doesn’t necessary reflect what keys are pressed to construct those files. For example, while I don’t configure my editor to automatically insert parenthesise, braces or apostrophes, if I had such feature enabled, methodology chosen here would overestimate use of punctuation characters. Looking at the files also ignores effects of copying and pasting text. It’s hard to tell whether that would affect the data though or whether the effect balances itself out.
Overall though, I’m fairly satisfied with the results demonstrating that for me Programmer Dvorak was a better choice than regular Dvorak layout.
Since inevitably someone will be curious about comparison to Qwerty layout, the statistics for the letters are as follows:
Asterisk indicates keys towards the middle of the keyboard which index finger needs to stretch sideways to reach.
Interestingly, this also shows that swapping ‘i’ and ‘u’ keys on Dvorak-based layouts makes some dose of sense. At least in the source code I write, the former is used over twice as frequent as the latter.
i is a common loop variable so that may have something to do with it.
† Then again, I usually type on Kinesis Advantage keyboard with a small dose of remapping. This puts at sign under my middle finger at the very bottom of the keyboard. As a result, it’s slightly easier to type than equals sign which requires my index finger to be stretched far up and to the right.