Know Your Tools
15 OctoberDo you need to switch between files regularly?
Find a way to do it in under a second.
Do you need to move your editor’s cursor to the start of a particular word regularly?
Find a way to do it in under half a second.
…move sections of code a few lines up or down multiple times per coding session?
Find a way to do it in under a tenth of a second.
…make the same edit to multiple sections of code regularly?
…type in the same thing over and over?
…rename variables and functions?
…go to function signature?
…find all references?
…run related tests?
Find a way to do it fast, and do it that way.
Typing Fast is not Doing Fast
I’ve programmed in various editors and IDEs including Emacs, NetBeans, Eclipse, IntelliJ, TextMate, SublimeText, Atom, VSCode, and a few more. A weird lesson I learned after I transitioned away from coding in Emacs was: I felt fast in Emacs, but I wasn’t actually fast. I could type myriad Emacs keyboard shortcuts (relevant xkcd) quite quickly, but opening files using SublimeText’s fuzzy search was significantly faster. In Emacs, my fingers moved very fast. Heck, I was even told it was impressive how quickly I worked in Emacs. Then, in my next editor, my fingers still moved just as fast but I only needed a fifth of the keystrokes to do the same thing.
Aside: I’m aware Emacs can fuzzy search, and I’m aware Emacs lets me define my own shortcuts. I used to have a giant folder of emacs configs which I would install on every computer I needed to code on. Because of that burden I had grown this core urge to make as few customizations to my editor as possible so that I can quickly edit code on any computer.
In Emacs it took me something like 5-10 seconds to open a deeply-nested file 8 subdirectories down from the current directory. A flurry of typing the first letter, tab, the next letter, tab, and so on until I press enter and the file is open. Then in Sublime it took under 2 seconds, usually under 1. The point is: I frantically typed the special Emacs incantation for opening a file, and it happened as fast as my fingers could type the 20 keystrokes necessary. Then I found out another tool could do it in 4 keystrokes.
And then, I don’t remember if it was in SublimeText or TextMate, but there was an extension which gave me a keystroke to switch directly to the test file for the already-open code. For that task which I did all the friggin time, I could then do it almost instantaneously.
Typing fast is a prerequisite, doing fast is better.