Pair Programming
Pair programming is a software engineering technique in which two software engineers work together on the same problem.
1 Benefits
1.1 Peer Learning
1.1.1 Mentor/Mentee
Particularly when onboarding new developers, or when one developer has a lot more experience than another, pair programming is a great way to transfer this experience between the developers.
It is a good idea to have the less-experienced developer be the driver and the more experienced developer be observer. This way all code that is written has to go through the less-experienced developer’s hands, which means they will probably retain more of it due to their active part in it. If they are merely observer, the driver might be implementing too fast for them, so they don’t learn anything and can’t contribute.
It is undecided whether it’s a good idea for the unexperienced developer to ask questions right when they come up, or after the experienced developer has told them what to type exactly (so that the answer might become clear without having to ask the question). I’d advise to try out both and see which works better in your case.
1.1.2 Problemspace
When pairing, two people need to understand one problemspace, which means that if one becomes unavailable for some reason, there’s still someone who knows what is going on. This is a great failsafe for when people get sick but something is critical.
1.2 Four eyes see more than two
When working with someone else, there’s always someone looking over what you’re writing, which means that some errors can be caught earlier. This shortens the feedback loop and can save time.
When two developers spent most of the time on the same problem, a code review should still be done, as they are still prone to the same errors a single developer would make.
2 Implementation
2.1 Driver vs. Observer
In pair programming, there’s usually two roles: the driver and the observer.
2.1.1 Driver
The driver is the one at the peripherals (mouse and keyboard).
2.1.2 Observer
The observers only talks and doesn’t actually touch the keyboard or mouse.