03 April 2011

Typing vs. Editor Kung Fu

There have been some interesting blogs about the role of typing in programming, specifically I am referring to Jeff Atwood’s "The Keyboard Cult:", and in general his series on the topic and John Cook’s rebuttal: "How much does typing speed matter?". IMHO they both make good points and they both miss the point as they don’t take into account the role of Editor Kung Fu.

It’s not your typing speed, but your editing speed, which is painfully obviously to me as I clumsily type out this entry. Whoa, I’m having a weird self referential moment right now. My typing skills are mediocre in comparison to others I have seen, I position my fingers mostly correctly, however, I occasionally have to look and I’m slow when I have to type every character.

However, my relatively slow typing speed is irrelevant to my programming speed, it really boils down to the editor you use and how you use it, I mostly use a relatively obscure editor called Zeus, the reason I use this editor is because it supports an arcane key-mapping known as the Brief key-bindings, which originates from a DOS, yes MS-DOS, based editor called Brief, which I believe had some similarity to Emacs. I learned this a while ago, obviously, but the key-bindings and features are incredibly powerful, I feel that I am 3 to 5 times faster using these key-bindings vs. traditional vanilla Eclipse key-bindings and features. Due to my Editor Kung Fu I have seen cases where I easily outperform, in code production, other programmers who have superior typing skills, and of course this is partially due to a difference in ability and experience.

Interestingly this essay evokes a few of anecdotes from my career, one was by a coworker from about ten years ago who was noticing that when I was working my hands barely left the key board, he added that the younger programmers used the mouse much more during coding. Perhaps, my most poignant example demonstrates the true power of having a highly sophistimacated editor, a few years back I was working with a DBA and we needed to create a script that would replace a specific database field with a list provided in an excel file, about 300 rows that needed to be updated. Both the old and new value were provided as matching columns in an excel file, I spoke with her and she told me what needed to be done, using column cutting and pasting I was able to create the entire script, consisting of 300 update statements in a matter of minutes and I emailed it to her. She called me back after receiving it, and she was blown away that I had already written the whole script, I told her it was just editing tricks and that she could do it if she knew my editor, she responded with "I need to learn that editor."

My most surreal account would be that on a couple of occasions I’ve been told that my screen looked like the Matrix when I was coding, this wasn’t due to my lightning fast speed but to the use of keyboard macros to modify long SQL insert scripts, the weird thing is it really does look like the Matrix, ironically I never noticed it myself, probably because at the time I was in the Matrix.

My editing speed is also in part, due to experience, recently a young programmer remarked as he watched me edit, "You are so fast, man," and I replied, "It’s just a lots of years of practice." I mostly agree with John Cook’s points, however, I disagree about the musical analogy, when I am in the zone coding, I feel like I am working that keyboard like a musical instrument, it’s hard to describe, you just have to do it to know what I am saying.

When you construct a compiler you create several components the two "front end" components are the Lexical Analyzer and the Parser, these two create what is known as an Acceptor, although this particular Acceptor would be a PDA. I feel that when you type every character you are programming at the lexical level, when you are cutting and pasting variable names and other constructs you are programming at the Syntactic level. When you are coding at this level your edits are more conceptual.

Keyboard macros are a powerful feature, in Brief/Zeus you can perform an operation and record it and play it back, also no decent editor is without Regex Search and Replace, and any powerful editor will have column cutting and pasting. The true beauty of the Brief key-bindings is that it provides you with rich and easy to use cut and pasting and it turns the keyboard number pad into an editing super controller which lets you keep your hands on the keyboard, going to the mouse will always slow you down.

Editor Kung Fu is when your brain, fingers and your editor move in concert to produce code quickly and efficiently, which means that superior coding ability includes a combination of: "Typing" + "Editor Kung Fu" + "Ability."

So there it is: My Kung Fu is the best.

No comments:

Post a Comment