As Mike Hill says, “the hard part of programming is the thinking,” and not the typing. And yet in this Compulsive Coder blog series, I’m focusing on the very little things, things that might save you as few as milliseconds in some cases:
Auto-generated comments that you can simply delete in a quarter second.
A color scheme that might trigger slightly faster recognition about something important.
And in this post, I’ll implore you to delete lines (like those auto-generated comments) in one keystroke instead of three.
Is all this a waste of time? Shouldn’t we be focusing on bigger, headier things that *are* the bottleneck–such as ways to ensure your code stays clean, so that you don’t waste monstrous amounts of time on code comprehension? Sub-optimization goes against the lean software edict to “optimize the whole.” Why bother?
I’ll offer a few reasons:
Less typing ==> fewer opportunities to screw up. Let the computer do the work, it’s rarely wrong! Jeff Bay, via Twitter: “fixing obscure bugs because of obscure f-ing types is a major bottleneck.“
Wasted time adds up. A mere hundred unnecessary movements across the course of a day add up to half a million across a twenty-year career.
RSIs are real, and unnecessary movements similarly add up.
Moments you spend on mechanical operations–hunting and clicking, or sequencing together operations–are things that distract from your thought process.
To me, it’s about having the craftsman mentality of caring, more than anything. A craftsman is always seeking better individual approaches to building software. They seek to optimize frequent operations by minimizing the waste involved. They don’t tolerate regular inefficiency.
So, my nit. Real small, real short.
We delete lines often enough in programming. I watch some programmers do
so by first navigating to the beginning of the line (if needed),
highlighting the text to the end of the line, and then cutting the text
Cmd-X, e.g.). Ridiculous.
In Eclipse, it’s simply
Cmd-d (by default). In IDEA, it’s
Cmd-Delete. If you have Vrapper (a VIM plugin), it’s
operation, not three.