Delta Engine Blog

AI, Robotics, multiplatform game development and Strict programming language

A new more effective keyboard layout for programmers

Hey now, I'm back again. Lets just pretend I didn't stop blogging the last couple of months ^^ From now on I will try to post stuff every other week, I still got some interessting topics.

Quick links


About Lost Squadron

The project was paused because I got noone modeling the missing models (my intern Ivo quit in the middle of the project because he had to find a job), most of the engine and game logic is pretty much finished (and has gotten way more complicated than planed). I will post some screens and info from time to time, usually I will finish up projects like this some later time when I got the missing resources or time (maybe next chrismas). Sorry for not informing you about the latest progress, but I talked myself into continuing the project and realised to late I can't finish it on my own now.

Currently we at exDream have finally started working on the next project and will produce a nice graphic demo/prototype in the next 3 month. I will try to sneak in a couple of screenshots of it from time to time.


Todays topic

A new effective keyboard layout for programmers, especially for c# and c++:

Download AbiKeyboardV9 installer
Download the CountMostUsedKeys program (see below)
CountMostUsedKeys source code for anyone interessted.

2 years ago I was talking with a friend about my english keyboard layout and discussing why it is way better than the german keyboard layout for programming (for some keys you even need a special alt gr key combination). The english keyboard is better because the symbol keys like ()[]{}'":;/ etc. are positioned more effective. This is the english keyboard for comparsion with Dvorak and my own layouts below:

We talked a bit about other keyboard layouts like Dvorak, which is way more effective and relaxing than any qwerty layout, but I got no free time back then. You will need around a week to learn to type at low speeds and at least a month to get back to a better typing speed.


Dvorak

This is the Dvorak us keyboard layout (you can simply select it in windows, it is pre installed and can be used like any other keyboard layout):

After Arena Wars was finished last year I got finally some time to start learning Dvorak. Dvorak seems very nice (see the links below for additional information) and has a lot of advantages for typing "normal" text (but some people exaggerate "a little").

Anyway, while playing around with Dvorak (us default layout) I really found some things VERY annoying, especially for coding and playing games:

  • It is fairly hard to learn a new layout and getting really back to the old speed again. Additionally hotkeys you typical need on a computer are totally crazy and unusable. Hard to learn when you used QWERTY all your life, learning can be done in a week or so, but really being able to get back to your old speed can take months (and is painful).
  • Ctrl+X, Ctrl+C, Ctrl+V can't be used as easy. I always use my left hand while my right hand can use the mouse, especially for browsing, code comparing, getting text from one place to another, etc. and all this happens VERY often! I know you can also use Shift+Insert, Ctrl+Insert, Shift+Delete, but these shortkeys are just plain unuseable, maybe for lefties, but the keys still suck.
  • Hotkeys can't be used the way they used to be, for some games its possible to change hotkeys, for others not (like starcraft, at least its not easy to change) This does not only apply to games, but also a lot for applications, especially when you remembered just the location where to press and not the name of the hotkey, e.g. when using photoshop, you have to re-learn the hotkeys. Also stuff like Ctrl+S, Ctrl+O, Ctrl+F, Ctrl+R, etc. is usually remembered by the positions on the keyboard and not by the key and relearning this keys is pretty hard!
  • Dvorak is optimized for typical english words, but not for programming, some keys are even worse than the german keyboard layout. But what I really don't like is the way Dvorak handles symbols like []{};:?+-/, etc.
    Its not that QWERTY is really good for coding, especially when typing stuff like () or -, = or +, but overall it performs still better than Dvorak (counting only symbols).

I've also collected some interessting facts when comparing Dvorak and QWERTY considering c#/c++/java code. Click this link to test it yourself.

  • When pasting random stuff into the Keyboard Compare Applet, QWERTY performs almost twice as good as Dvorak (Note: We are not random key generators, usually we type text or code which makes sense ^^).
  • When just pasting c# code stuff without much text like
    if ( a == 0 )
    {
    doIt( a!=0?a:0 );
    } // if

    QWERTY still outperforms Dvorak, which can't be good!
I wanted to code faster and not slower, I don't know anyone using Dvorak anyway and I could not care less if others can use my keyboard layout or not (since I use an english keyboard layout anyway and other (german) people can't even use that ^^).

I created my own keyboard layout to solve all the problems (yeah, now its getting real geeky), but I based it on the Dvorak layout, which is really efficient and nice for typing "normal" text (which is still required a lot, even by crazy coders).
To solve the Ctrl+X, Ctrl+C, Ctrl+V problem I simply moved that keys to the QWERTY position and exchange the other keys accordingly. This didn't matter much because there isn't much of a difference between X,C,V and Q,J,K according to the key usage (see below).

At this time I was already using Dvorak for about a week or two and had spend a lot of effort into learning and thinking about improvement, I wanted a perfect solution. I checked typical c# and c++ code and wrote a program to count how often each key is used. Now I got the most important keys and asigned the best spot for each symbol using the distance (see the Keyboard Compare Applet) and how much it is used. Using shift is also a major impact IMO, especially when keys are far away.

So I wrote a little test program to count the used keys in all my *.cs files in my code folder, check out the results below.

Screenshot of the program (I improved it yesterday, it was a console tool before):

Download the CountMostUsedKeys program.

And the source code for anyone interessted
(may be useful if you want to write some line count tool yourself)


CountMostUsedKeys results:
Search mode=Everything, File type=*.cs, Directory=C:\code\
Number of files=4041, Number of lines=2031908, Number of keys=67829575

Type: Keycode: 3210,1%(6851259 times used)
Type: eKeycode: 1017,21%(4887698 times used)
Type: tKeycode: 1165,2%(3525648 times used)
Type: aKeycode: 974,13%(2802961 times used)
Type: rKeycode: 1144,06%(2754960 times used)
Type: iKeycode: 1053,93%(2663137 times used)
Type: nKeycode: 1103,68%(2494441 times used)
Type: oKeycode: 1113,39%(2298022 times used)
Type: sKeycode: 1153,24%(2195958 times used)
Type: lKeycode: 1082,61%(1769538 times used)
Type: /Keycode: 472,52%(1710099 times used)
Type: uKeycode: 1171,99%(1349478 times used)
Type: mKeycode: 1091,91%(1298573 times used)
Type: cKeycode: 991,77%(1201477 times used)
Type: dKeycode: 1001,77%(1198823 times used)
Type: .Keycode: 461,42%(964040 times used)
Type: pKeycode: 1121,41%(956931 times used)
Type: gKeycode: 1031,23%(832686 times used)
Type: fKeycode: 1021,22%(827820 times used)
Type: yKeycode: 1211,15%(783356 times used)
Type: hKeycode: 1041,11%(753548 times used)
Type: )Keycode: 411,09%(739711 times used)
Type: (Keycode: 401,09%(736841 times used)
Type: ;Keycode: 590,86%(580753 times used)
Type: bKeycode: 980,79%(532778 times used)
Type: ,Keycode: 440,76%(512629 times used)
Type: =Keycode: 610,74%(503579 times used)
Type: wKeycode: 1190,62%(419356 times used)
etc.
Note: This stuff does NOT represent every key pressed, hotkeys and errors and corrections are obviously not saved in the text files.

Same results without space and letters, very useful to assign the most important symbol keys:
Search mode=ExceptLetters

Type: /Keycode: 472,52%(1710099 times used)
Type: .Keycode: 461,42%(964040 times used)
Type: )Keycode: 411,09%(739711 times used)
Type: (Keycode: 401,09%(736841 times used)
Type: ;Keycode: 590,86%(580753 times used)
Type: ,Keycode: 440,76%(512629 times used)
Type: =Keycode: 610,74%(503579 times used)
Type: "Keycode: 340,38%(255445 times used)
Type: <Keycode: 600,32%(213786 times used)
Type: >Keycode: 620,3%(203429 times used)
Type: }Keycode: 1250,28%(187354 times used)
Type: {Keycode: 1230,28%(187017 times used)
Type: +Keycode: 430,27%(181705 times used)
Type: -Keycode: 450,24%(159515 times used)
Type: ]Keycode: 930,19%(130828 times used)
Type: [Keycode: 910,19%(130687 times used)
Type: _Keycode: 950,13%(89213 times used)
Type: *Keycode: 420,12%(83203 times used)
Type: :Keycode: 580,11%(77487 times used)
Type: !Keycode: 330,1%(64444 times used)
Type: &Keycode: 380,09%(58918 times used)
Type: #Keycode: 350,07%(47258 times used)
Type: |Keycode: 1240,05%(34348 times used)
Type: 'Keycode: 390,05%(31284 times used)
Type: ?Keycode: 630,03%(19709 times used)
Type: \Keycode: 920,02%(15340 times used)
Type: %Keycode: 370,01%(7019 times used)
etc.


Based on that I created my own keyboard layout, which was updated 9 times until I was happy with it.

Version 1 looked like this (pretty much like dvorak, some cosmetic changes at the right side):

Version 2: The next thing I did was moved the Z X C V keys back and copied some keys around, () are moved to normal keys, () is used much more than [] or {}.

In Version 3-6 I tried moving some keys around based on the distance and effectiveness, but I moved most of them back because they felt really uncomfortable and were bad for hotkeys. One bigger change was moving the . , () keys back down, which improves typing speed a lot because we really need more keys on the left side when using the mouse with the right hand and when typing the right hand can easily handle most of the symbol keys on the right side.

Version 7 was pretty much the final version, I trained this version a week and except some minor cosmetic changes in the upper row everything stayed this way till the last version:

Version 8 and 9 changed only the positions of J D F K B and the ? | and + - keys, at first I didn't like the position for b at the right side, but b is used a lot in combination with vocal keys unlike j, it is much better to have it on the right side. The + - key on the upper left is now the same as the key on the lower right (which is not present on all keyboards).

This is the final Version 9 I am using for nearly 6 months now, I got up to my old speed in the first 1-2 months and now I type even faster and more relaxed than before (maybe around 400 keystrokes per minute for normal text if I try hard). I wouldn't suggest changing your keyboard layout just because you might be a little faster with Dvorak or my keyboard layout, I think the comfortablity is at least as important as the speed. In my option the greatest thing about my keyboard layout (or dvorak for normal text) is the fact you can type most of the time without moving your fingers much (90% of the most used keys are directly on the center row).

Download AbiKeyboardV9 installer

I was not trying to create the best keyboard layout ever or to make Dvorak obsolete, I just want to improve it for me and other interessted programmer. If you get started with Dvorak or my keyboard layout you should use some keyboard training tool and spend a couple of hours (but not much longer) each day training it. I found this website very useful: Learning Dvorak

The main reason I wrote this article now was the nagging of some people I told about this and who wanted to know more, so keep nagging if you want to see articles like this :)

If you got comments or some ideas to improve this even more, let me now!


Useful links

Introducing Dvorak
Keyboard Compare Applet (nice)
Best keyboard layout creation tool, hidden and hard to find, but this is the only free useful keyboard layout creation tool.

The Dvorak Keyboard and You
Changed Dvorak for similar symbol keys
Learning Dvorak
Pic of Dvorak default Layout (us)
Critik to Dvorak
Keyboard Layout Manager (allows to change keyboard layouts) It's shareware.
Some discussions about Dvorak (coder related):
Dvorak discussion 1 Dvorak discussion 2 Dvorak discussion 3