There is a condition that takes place known as Change Blindness in which otherwise healthy attentive humans miss obvious alterations in their visual field. Typically it happens when there is some disruption or distraction, but can happen in a blink, or even when the mind's visual presentation (imagination) grabs your attention for a moment. The reason that driving and talking on the cell phone is so dangerous is that your mind is constantly trying to build a visual representation of what you're hearing and THAT visual image conflicts with the physical reality in front of you. It is curious that having the same conversation with a passenger doesn't represent the same risk.
The video here is really interesting as magician Derren Brown constructs a test in which he asks for help reading a map. As he is receiving help he arranges for an interruption, after which he (Derren) is replaced by someone else. Watch the video and notice how many people seem to be totally unaware of the switch. In one case the new person is very different from Derren. In only one case, does the helper/victim/passer-by seem to take any notice at all; and in that situation the helper is with a friend. That, is the point of this post.
See below for a longer version.
Pair programming is a technique in which two individuals sit together at a workstation and write code. Superficially it sounds like a colossal waste of money; paying two to do the work of one. In reality, two people cannot code, they cannot both run the keyboard. So quite naturally, one does the typing, which forces that programmer to focus on syntax and other very low level details. The other programmer, while not forced to think higher, naturally does, constantly looking at the consistency of the code; variable names, API construction, naming conventions, logic holes, indexing alignments, endless loops, and other bugs. The non-typists tends to see architectural flaws, not so much in the design per se, but in the implementation of the design.
It really isn't a matter of the first programmer not paying attention so much as it is the first programmer being blinded by their own internal visual model. They see what they think they should be seeing. The second programmer, obviously the passenger, sees what is actually there and can more easily spot inconsistencies. The result is higher quality code; faster. Again, this is counter-intuitive, but I've seen this work. I used it myself, and I've seen others use it too. And to answer the first obvious question, No - it doesn't work to have one coder write the program and a second one look it over later on.
First, the second programmer will only ever skim the code. Secondly, even if they read it line by line, they are likely to let small things go rather than comment on them. You want both programmers together as the code is being typed.
While we're on the subject - given any two programmers, which of the two do you think should be typing; the one with more experience, or the one with less? Actually, they should probably take turns, but generally better code will result when the junior programmer is typing. Malcolm Gladwell describes in his book, Blink, that the junior person (Co-pilot, apprentice carpenter, Programmer I) is less likely to call out a mistake to the senior (Pilot, Master Carpenter, Programmer III), but the senior has no trouble mentioning an issue to the junior.
Here is another favorite of mine which involves simple counting. The distraction point comes in the form of a bouncing ball as you simply try to count how many times the ball passes between the players. Remember to pay attention. Watched it? All the way through? Feel stupid? Don't.
Here's another one; and I'll give you a hint - it really is about changing colors.
Now go get two people who have never seen it and ask them to both watch the videos together, but tell one of them to count and the other one to NOT count. The other one is to watch the video, but they are not there to validate the number of bounces. What do you think will happen.
Here is the longer version of the Derren Brown video.