Java Programmers’ Dirtiest Little Secret

November 21, 2008

Some of you will have read Steve Yegge’s 3500-word rant about programmers who can’t touch type (from whence I unashamedly stole this post’s title) or at least Jeff Atwood’s more succint version of the same idea. For those of you who were too lazy to read the above, the basic premise is that non touch-typists are less productive than their touch-typing counterparts. Today I’m going to talk about another group of people, who are equally annoying: programmers who use their IDE as if it were just a file manager with a built-in text editor.

When I started my first Java-related job, I remember thinking to myself that one of the best things about developing with Java was the excellent IDE support for code navigation and refactoring. Despite the fact that IDE support has only gotten better since then, I still see people search for a Java class by repeatedly expanding folders in the package tree until they find the right file (normally pausing to think which package the class is in) or rename a method using a primitive cut & paste technique. These are inefficient ways of doing something that is 1 keyboard shortcut away, or 2 clicks away, and are really frustrating to watch (a bit like being stuck behind an extremely slow driver).

When programmers don’t take the time to learn the IDE’s features, but I don’t think laziness alone is the cause. In fact, I believe laziness makes good programmers, at least when coupled with an inclination for problem solving. Take me, for example: I am one lazy bastard. I need to find a class. I’m going to hit Ctrl+Shift+T and BAAAM, I’m all up in that mother. There is no way I’m going to move the mouse around and click like crazy to get there. These guys are different: they don’t mind repeating the same mind-numbing cliking, typing, copying and pasting, over and over again. Perhaps they think that’s what programming is about?

It’s getting late and I’m not drunk, so I’m going to have to wrap this up. Here is my contribution to the betterment of Java programmers everywhere (Eclipse only, sorry! I now know better):

Navigation 101

  1. Open Type (Ctrl+Shift+T). Tip: use only the first letter of each capitalised word (e.g. BAOS for ByteArrayOutputStream).
  2. Open Resource (Ctrl+Shift+R). Same as above.
  3. Quick Type Hierarchy (Ctrl+T). Use this on a method to see where it’s overriden or declared.

Refactoring 101

  1. Rename (Alt+Shift+R). Use this to fix names that suck.
  2. Extract Method (Alt+Shift+M). Apply when you want to reuse that sexy piece of code elsewhere.
  3. Extract Local Variable (Alt+Shift+L) and its counterpart Inline (Alt+Shift+I).

For more information on the motivation for refactoring, and to understand the mechanics of each refactoring, check out Martin Fowler’s Refactoring book.


Re-Rewind…

November 10, 2008

A few months ago my computer’s hard drive started displaying signs of impending failure: occasionally the disk would not be detected by controller, leaving my computer unbootable. A couple of reboots and a patient 5-to-10-minute wait would normally get me into Windows though, so I wasn’t terribly worried.

But I was worried enough that I set up an automated backup mechanism using the awesome rdiff-backup. After all, nobody likes to lose many years worth of photographs, documents, saved passwords, accounting files, and minesweeper high scores. With only a trivial shell script, I was able to configure rdiff-backup to do its thing onto an external hard drive connected to a Linux box on the other side of my bedroom. So when the time came for the drive to kick the bucket last month, I couldn’t help but feel smug about myself. Data loss can’t touch me—I have backups.

I was obviously tempting fate with these kinds of thoughts, and it didn’t take long for me to realise it. About two weeks after having laughed in the face of danger, I carelessly shut down the PC that hosts the backups, which was being particularly noisy and was keeping me from sleeping. The next day, I turned the PC back on before heading off to work. It was about that time that fate reached out and punched me in the nose: the USB hard drive wouldn’t power up, no matter what. I used my trusty old “try again in 5 minutes” strategy, but the drive was having none of it. I was data loss’ bitch.

Fortunately I found this excellent guide by Scott Cramer, which suggested I may be able to recover my data by removing the drive [1] from its case and hooking it up to another PC via its SATA interface. This worked beautifully, and I was able to recover all my important data with the help of a friend’s computer, but it could have as easily not have worked. Let this post serve as a friendly reminder for you to get into the habit of backup up your valuable data, or asking the machine do it for you automatically. There are several applications you can use to do this. I can recommend rdiff-backup, featured above, or Mozy for the less technically-inclined.

You probably hate me for having wasted ten minutes of your life right now, but you will thank me later, when your suffer hard drive failure and backups save your behind. Bo, selecta.

[1] A Western Digital MyBook 320GB.


Welcome

November 5, 2008

Hello and welcome to my brand-new WordPress blog. My goal is to use this blog as an escape valve of sorts, where I can vent any technology-related frustration that I am experiencing, hopefully (for your sake) scattering it with nuggets of wisdom as I go. :P

I will inevitably also use it for replying to immature blog entries from misguided youths, but such is the price one pays… Enjoy your stay!


Follow

Get every new post delivered to your Inbox.