Let’s be pretty clear about this. You’re doing pairing primarily to gain in throughput, not as a training tool. That being said, pairing can be a very effective way to transfer knowledge and mentor junior coders.
Something to keep in mind as you pair is to look at the bigger picture of the project. Sometimes pairing with a much junior developer will make the immediate task take longer than it would if you were flying solo, but that’s not completely the point. You (I) must be patient. If you can use the pairing experience to improve the effectiveness of your colleagues the team as a whole will come out ahead in the end in terms of team velocity. To employ a sports metaphor in basketball, the very best players are considered to be the ones who can make their teammates better. I was thrown into leadership positions very early in my career when I was still struggling with improving my own personal velocity, so I never really grasped the value of improving team velocity until much later. One of the very real advantages of agile development is the concept of collective ownership and putting the focus on a team completing working software instead of checking off your own personal deliverables. I think it’s a subtle shift, but it’s really changed my outlook on software development. Someday I’ll even internalize that kind of thinking.
One simple benefit of pairing for me has been picking up IDE tricks and learning new tools from other developers. Don’t underestimate how much faster you can be with a good toolbox of keyboard shortcuts. Last summer my team was a very early adopter of the original ReSharper beta (I’m gonna wait a few more builds before I try the ReSharper 2.0 beta this time though). We had several guys that had quite a bit of experience with the IntelliJ IDE for Java. These guys suddenly became much quicker mechanically than I and the others who weren’t IntelliJ users. We made a new rule for a little while that the driver had to yell out the keyboard shortcut they were using to make the ReSharper magic happen. A couple months later I was coding solo on an airplane and realized how much faster I was getting with the IDE.
Other examples I can vividly remember was my first exposure to WinForms development, Subversion tricks from my “BuildMaster” guru colleague, and getting other developers to use TestDriven.Net for faster cycling between coding and unit testing with NUnit.