Friday, February 29, 2008

Don't Make Me Think: A Common Sense Approach to the Desktop

I haven't read this book, but I often use the brilliant title during code reviews and when talking about software. It's a fine variant on the KISS principle.

Lately though, I've come to implement the gist of the idea when it comes to refactoring. Particularly with respect to colour.

Background

It is well-known (especially since Blink) that when we are in 'the zone', we aren't thinking: sure, we may form strategy but really we are reacting.... flowing. I think it's important, on our desktops, to recognize the cognitive speed bumps that disrupt that flow.

Lately, I've been working on a major refactoring of a large project. Here are some basics:

  • We're using a task branch in the source-control tool. Often we have 2 IDE instances running: one for the main branch (pre-refactor), and one for the task branch (the new work).
  • We often run servers, alternately, for both projects on the Desktop.

The IDE

We are using Eclipse 3.2. Some of my teammates have changed the configuration files so that the window title will read "Task Branch" or "Main Branch" as appropriate.

That's fine, but that still seems like a speed bump to me. When I am frenetically switching from one IDE instance to the other, studying code, I don't want to look all the way up to the top left corner. I don't like mouse dragging and when I'm cookin', I don't like eye dragging.

This is hardly rocket science, but I use different highlight colours in the instances.

Check out this example of an Employee class in a fictional main branch. I use orange as a subliminal warning (i.e. don't change this one).



For the task branch/refactoring, I like green:



Before long, these colours become effortless and subliminal. No eye-dragging! It's like a mini Heads-Up Display.

Btw, discovering how setting this in Eclipse 3.2 is not trivial. Here's how:

Windows -> Preferences -> General + Editors + Text Editors + Annotations, and select Occurrences.

Server Windows

Again, no rocket science here: it is trivially easy to change the background/foreground of windows in your operating system.

But do it for your JBoss/Tomcat/Console windows. Make version 1.6 white-on-blue... Make version 2.0 yellow-on-burgundy. Or choose the team colours of your team or alma-mater.

I often use command shells for a given branch, and it freaks me out when I temporarily 'cd' from version X to version Y in the wrong colour. The ambient information becomes another tool in your arsenal.

The Upshot

Colour your world! It's an easy and effective way to keep things straight.

I'm interested in any tricks that you use in this regard.

ps. This doesn't involve colours per se, but my true love for reducing speed bumps is the use of Bash aliases on the command line. If you type more than 2 characters to 'cd' to your project's home directory, then you may want to check out this older post.

1 comment:

Anonymous said...

I think you're spot on. I, too, use Krug's excellent book title when talking to others about code maintainability. His book changed how I look at my code!

I'm prone to say "Don't make me think about your code."

I wrote about it here: http://blog.markturansky.com/archives/70