5 ways to get insane productivity boosts for coders
It is said that really good programmers are orders of magnitude more productive than the average ones. What makes this the case? And why isn’t this the case in other industries? I believe the answer lies in that computers are very good at automation. And good programmers know how to make computers do what they do best: that is, automate things. The best programmers are the ones who undersand this so well that they will not only solve the task they are directly working on, but learn to automate every step of the very process that leads them there. Here are some useful tips that may seem like common sense, except that most good programmers never go from good to great because of this.
1. Never look when you can search. Why look when you can search? Even if you’re looking for one item in a list of ten, it is always faster to type three or four characters than to scan the list with your eyes. Most reasonable environments including the popular editors and IDEs offer at least some way to do inline completion-based searching. Hit the shortcut and type the first couple characters identifying what you’re looking for and you’re there.
2. Don’t repeat yourself. Are you typing the same thing over and over? Make a shortcut out of it. Use global keyboard shortcuts to call up your favorite apps. On OSX/Unix,
alias is your friend. Make two character mnemonic aliases for everything. Corollary: Never Mouse when you can Key. A good approach to learning built in shortcuts is every time you reach for your mouse, make a note of the shortcut key for the action you’re performing, and then let go of the mouse and execute the action from the keyboard. Then do it two more times.
3. Learn a scripting language. Bash, Perl, Ruby, Python. Pick one and learn it. Perl used to be the king of one liners. These days I find myself reaching for ruby more because I use it on a daily basis anyway. Automate common tasks with bash and ruby.
4. Learn an editor. I mean a real editor. Both vi and emacs are acceptable choices here. Some people like TextMate but after PeepOpen came out for vim, delivering vim’s One Missing Feature, there’s really no reason to use TextMate over vim. With insanely fast window spitting, buffer searching, and text manipulation, you’ll save yourself thousands of keystrokes a day by using vim. There are good dotfiles that make it look just like TextMate anyway.
Corollary: Use that editor everywhere. Now that you know vi, type set -o vi on your bash command line. Now use vi to edit your command line. Instantaneous productivity boost of about 10x. If you’re an Eclipse junky, use the Vi plugin for Eclipse.
If you learn one thing in vi: learn to move around using the home row keys, skip words using w, b and change commands such as cw (change word), or ctA (change from current position until the next occurrence of A). This becomes second nature because you look ahead as you type the command to achieve efficiency. There are plenty of tutorials, use google or the built in vi help system.
5. Learn regular expressions. There is no excuse not to know at least the basics. You don’t have to be a regex guru, just be functional. It probably takes a lifetime of meditation to achieve true regex enlightenment. But spending an hour a day trying to use regexes will take you 80% of the way. Read the perlre manpages, that’s where I got my start. Learn to use regexes in your editor to search, on your command line for quick one off scripts, in your programs to do text manipulation.
None of these things are hard, they just take practice and dedication to become true habits. The most important way to turn them into habits is to establish a routine that forces you to apply one or more of these principles and ideas every day.