Pair Programming, “Recognition vs Recall” and Keyboard Shortcuts

I cannot find anything about this in suitable detail on the web so I am writing my own:

what we “learned” in school

IT students (including myself way back when) have been sold the story that recognition is much better than recall when they use software, in fact its evolved to the mantra “recognition over recall” for all things IT and web related. Of course its right, when using a GUI or windows XP or something new on the web, and especially if I am a new user I’d like to recognise things that I can click, I don’t want to have to read a manual and have to work out what to do, and learn the hard way else I will use something else, another operating system or different website.

However when it comes to repeated actions, including software development, especially using IDEs its a completely different story. You might then say, hang on a minute why wouldn’t recognition work here. But let me start with the driving analogy as most of you will be able to drive.

Car journey

Lets take a car journey using recognition for driving.
Get in the car, adjust the seatbelt, start the car, wait. how do I do that, oh yes, turn the key hang on gear stick, is it in neutral? no, push the clutch in, wheres that? oh yeah left foot, turn the engine on, bring up the clutch change the gear, I can see all of these, this is good, the car starts moving I can look and go for a drive, eek the car is revving, back to the gear stick, change gear, oops need the clutch, clutch in change gear, revs are fine, ah yes the road, what are those? mirrors oh yes anyone behind me? anyone in front of me? yes, brake, car slows down engine struggles, oh yes change gear, hold on push in the clutch change the gear use the clutch look at the road. Where were we going again? Oh yes turn left, which means look a the mirrors make a signal, look at the indicator stick and use it (left hand side for english car, right hand side for japanese) look back at the turning slow down, take the turn. Phew.

Notice how I wasn’t focussed on the journey. Many of you will remember this is what it was like when learning how to drive a car.

Now lets take a car journey using recall.

Get in the car, (habitually put seatbelt on) start the car, (left foot on clutch automatically put it into first) car pulls away, you look at the road, anyone behind? anyone ahead? yes slow down,(change gear), left hand turning coming up, turn left, check behind and automatically signal.

Whats the difference? Well in the second example I had learned and put into a recall mode HOW to drive the car and I was more focused on going on the journey.

I was thinking more about the journey as opposed to how the car works. If I have to think more about how the car works everytime it can get exhausting when the purpose of driving is to go somewhere.

Right lets bring it back to programming.

Or more importantly the word “Recognise” involves cognition thinking, it literally means “to know again”; when you are recognising something you are actually thinking about it. If you are thinking about it then you are not thinking about anything else. You are context switching, and we humans dont multitask well at all.

However if you can recall an action, you can sub-conciously do the action while focussing on the problem at hand.

Lets take running a JUnit test in Eclipse as an example. Note the JUnit test key combination is probably one of the hardest to do of the shortcut keys:

Recognition way #1:

* grab the mouse
* look for the run icon
* see “Run as” hmm nothing under there
* go to “Run configurations” because you’ve just seen that, ooh unit tests appear
* click on run – unit tests runs
* get back to coding

Recognition way #2:

* grab the mouse
* look for the run icon
* spot the JUnit view, click on it
* see the “run again” icon
* click on it – unit tests runs
* get back to coding

Recognition way #3:

* grab the mouse
* look for the run icon
* spot the JUnit view, click on it
* right click on the unit test
* click on run – unit tests runs
* get back to coding

Recognition way #4:

* grab the mouse
* right click on the test document
* filter through the 50 options til you get “run as”
* see JUnit test click on it – unit tests runs
* get back to coding

There are more!

Recall way:

* Alt + Shift + X then T
* Worst case: “No JUnit tests found”
* Action: navigate (Alt and left arrow perhaps) to the unit test, then “Alt + Shift + X then T”
* Took 1 second, didn’t necessarily touch the mouse.

If you take the time to learn the Alt + Shift + X then T command, (just like you took time to learn to drive) then the Recall way is not only much faster it gives you more thinking to your problem domain.

The same applies to most actions which employ the mouse, if you are looking to “Do” a function then you are not “Doing the function”.

To quote the Matrix “Stop trying to hit me and hit me.”

Stop trying to code, and code, just like Rob said

Let me rephrase “Stop trying to code and code”

Its role within paired programming:

Firstly with two sets of eyes, the less time you spend faffing around with the mouse the more time both of you can spend on the code and the conversation about the code. When you pair program for the first time you notice how much time you waste by doing the code related tasks as opposed to doing the coding itself.

How do I learn this?

You can only learn it by practicing, no-one knows instinctively how to drive and change gear and follow the rules of the road, the best way you can learn is by practicing often with someone else who will show you the keyboard shortcuts.
If you are completely new to it, start with the simple Ctrl+S to save what you are doing, rather than grabbing the mouse and looking for that icon, which inevitably is too close to the print dialog and “create new project” wizard.

If you dont have someone else to help, then here are a few shortcuts for Eclipse that will help you:

ps. I have noticed Ctrl+F11 works too, but I prefer “Alt + Shift + X then T”, you can easily do it with one hand without looking at the keyboard, get a different keyboard (especially with paired programming) there is often a different function key layout you need to look down all the time.

Oh and if you are an IntelliJ fanatic, good for you! #notThatIamJealous

This entry was posted in behavioural change, multitasking, pair programming, xp. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *