views:

538

answers:

3

I often hear complaints that programming languages that make heavy use of symbols for brevity, most notably C and C++ (I'm not going to touch APL), are difficult to type because they require frequent use of the shift key. A year or two ago, I got tired of it myself, downloaded Microsoft's Keyboard Layout Creator, made a few changes to my layout, and have not once looked back. The speed difference is astounding; with these few simple changes I am able to type C++ code around 30% faster, depending of course on how hairy it is; best of all, my typing speed in ordinary running text is not compromised.

My questions are these: what alternate keyboard layouts have existed for programming, which have gained popularity, are any of them still in modern use, do you personally use any altered layout, and how can my layout be further optimised?

I made the following changes to a standard QWERTY layout. (I don't use Dvorak, but there is a programmer Dvorak layout worth mentioning.)

  • Swap numbers with symbols in the top row, because long or repeated literal numbers are typically replaced with named constants;
  • Swap backquote with tilde, because backquotes are rare in many languages but destructors are common in C++;
  • Swap minus with underscore, because underscores are common in identifiers;
  • Swap curly braces with square brackets, because blocks are more common than subscripts; and
  • Swap double quote with single quote, because strings are more common than character literals.

I suspect this last is probably going to be the most controversial, as it interferes the most with running text by requiring use of shift to type common contractions. This layout has significantly increased my typing speed in C++, C, Java, and Perl, and somewhat increased it in LISP and Python.

+11  A: 

I still hold that typing speed is not the main factor in the time it takes for a project to be completed. If it is, there is a big problem (Weeks of coding saves us hours of planning).

Regarding your question I prefer using the standard layout as it means I don't have to spend the first 10 minutes looking stupid when presented with a standard keyboard layout.

Some of the replacements you have suggested, e.g. the top row with the special characters doesn't make a ounce of difference as the outside finger on the other hand should be moving to shift at the same time.

IMHO One thing that helps above chaining layouts is using only keyboard shortcuts. Vim and Emacs are recommended. It makes moving text around far faster.

Yacoby
Oh, no, typing speed isn't a bottleneck by any means, but at the same time, why let something as silly as a keyboard get in your way? I've had no trouble switching back and forth between my layout and others, because I use both frequently; I simply prefer mine. And I must admit, emacs makes programming fast as can be—when I don't have to look up a key sequence.
Jon Purdy
Oh, and the simultaneity of left and right hand movements also doesn't make a difference: the modifier still has to be depressed _before_ the key is struck. A difference of milliseconds, surely, but again, why hinder yourself? Programming with a layout that doesn't work for you is like programming on a sticky keyboard.
Jon Purdy
I maintain that by keeping several keyboard layouts in memory you are sabotaging your muscle-memory and thereby making your typing slower.
JesperE
The other issue with the shift key is sequences where you are alternating, so both hands are jumping from the top row to their shift key and back. I'm not saying it's common enough to worry about, though, but things like "(!*x)" might qualify as irritating.
Steve314
A: 

Changing the keyboard layout is a bad idea since it would (perhaps) boost your typing speed on one keyboard, but severely damage your typing speed on other keyboards or on computers where you don't have your special keyboard layout. I've found that it is often better to adjust yourself to the defaults, that having to change them everywhere. (Personally, my fingers are heavily Emacs-biased, which causes lots of typing friction everywhere else.)

JesperE
I happily switch between two layouts. Jon reports it's been "a year or two" and he has no trouble going back and forth. YMMV, basically.
T.J. Crowder
I find changing between keyboards and keyboard layouts as easy/difficult as changing between speaking in different languages -- if you know them well, after few minutes you regain full speed of thought.
liori
@liori: well said, though whether it's on the order of minutes or seconds is entirely dependent on how tired I am. :P
Jon Purdy
@liori *"after a few minutes..."* It seems that (multinational) companies and nations standardize on languages for a couple of purposes. 1) Speed of communication. 2) accuracy of communication. I suspect standardize keyboard layouts see similar benefits.
Jason D
@Jason D: Valid points, but I am glad they're not applicable to me... I rarely use other people's computers.
liori
@Liori. A good lot of companies have conference rooms with shared computers. And a good lot of developers will let someone else "drive" their computer when tag teaming a difficult issue. If others REFUSE to touch your computer due to your non-standard layout, you could be hampering cooperative problem solving. And for your employer, that eliminates the bulk of the *personal* benefits you reap with the chosen layout. Remember, development isn't usually one man against the world. It's usually done as a team.
Jason D
@Jason D: Oh, that's not a problem. Switching between keyboard layouts is as simple as clicking one button on screen... at least on my computer; especially that I still do use standard layout for games :-)
liori
+2  A: 

Overall, I think having a good text editor and knowing how to use it is better than trying to improve your typing speed. Being able to record and replay macros is sometimes a lifesaver, and a selection of shortcut-assigned code snippets can be handy because there's normally language-imposed limits on what can be turned into a library.

More generally, I think the real productivity enhancers are all about knowledge...

  • Knowing what tools and libraries are available and how to use them.
  • Knowing the overall structure of the code you're working on, not just your little bit.
  • Knowing key algorithms, design patterns and idioms so you don't have to reinvent them.
  • Knowing the rules well enough that you can be flexible - you know when to break them.
  • Knowing your co-workers and their strengths, weaknesses etc - ie knowing when to figure something out yourself, but also when and who to ask.

FWIW, I'm not claiming to be strong on all those. I've always been too biassed towards solving problems myself, and with too strong a tendency towards reinventing the wheel and grand architectural schemes.

Anyway, I just have this suspicion that time spent changing and learning keyboard layouts would be a distraction from more important issues.

Steve314
I agree with you on all counts! Making good use of tools and idioms is just good programming. But this is a question about one very specific thing, and hey, fifteen minutes two years ago has saved me a reasonable amount of frustration since.
Jon Purdy
@Jon - I get the point, but I think my typing habits are pretty strongly programmed by now - change would be hard work.
Steve314