Pair programming is a software development technique in which two programmers work together at one workstation. One, the driver, writes code while the other, the observer or navigator,[1] reviews each line of code as it is typed in. The two programmers switch roles frequently.
While reviewing, the observer also considers the "strategic" direction of the work, coming up with ideas for improvements and likely future problems to address. This is intended to free the driver to focus all of their attention on the "tactical" aspects of completing the current task, using the observer as a safety net and guide.
Pair programming increases the man-hours required to deliver code compared to programmers working individually.[2] However, the resulting code has fewer defects.[3] Along with code development time, other factors like field support costs and quality assurance also figure into the return on investment. Pair programming might theoretically offset these expenses by reducing defects in the programs.[3]
In addition to preventing mistakes as they are made, other intangible benefits may exist. For example, the courtesy of rejecting phone calls or other distractions while working together, taking fewer breaks at agreed-upon intervals or sharing breaks to return phone calls (but returning to work quickly since someone is waiting). One member of the team might have more focus and help drive or awaken the other if they lose focus, and that role might periodically change. One member might know about a topic or technique that the other does not, which might eliminate delays to finding or testing a solution, or allow for a better solution, thus effectively expanding the skill set, knowledge, and experience of a programmer as compared to working alone. Each of these intangible benefits, and many more, may be challenging to accurately measure but can contribute to more efficient working hours.[citation needed]
In an attempt to share goals and plans, the programmers must overtly negotiate a shared course of action when a conflict arises between them. In doing so, they consider a larger number of ways of solving the problem than a single programmer alone might do. This significantly improves the design quality of the program as it reduces the chances of selecting a poor method.[4]
In an online survey of pair programmers from 2000, 96% of programmers stated that they enjoyed working more while pair programming than programming alone. Furthermore, 95% said that they were more confident in their work when they pair programmed. However, as the survey was among self-selected pair programmers, it did not account for programmers who were forced to pair program.[5]
Knowledge is constantly shared between pair programmers, whether in the industry or in a classroom. Many sources suggest that students show higher confidence when programming in pairs,[5] and many learn whether it be from tips on programming language rules to overall design skills.[6] In "promiscuous pairing", each programmer communicates and works with all the other programmers on the team rather than pairing only with one partner, which causes knowledge of the system to spread throughout the whole team.[3] Pair programming allows programmers to examine their partner's code and provide feedback, which is necessary to increase their own ability to develop monitoring mechanisms for their own learning activities.[6]
Pair programming allows team members to share quickly, making them less likely to have agendas hidden from each other. This helps pair programmers learn to communicate more easily. "This raises the communication bandwidth and frequency within the project, increasing overall information flow within the team."[3]
There are both empirical studies and meta-analyses of pair programming. The empirical studies tend to examine the level of productivity and the quality of the code, while meta-analyses may focus on biases introduced by the process of testing and publishing.
A meta-analysis found pairs typically consider more design alternatives than programmers working alone, arrive at simpler, more maintainable designs, and catch design defects earlier. However, it raised concerns that its findings may have been influenced by "signs of publication bias among published studies on pair programming." It concluded that "pair programming is not uniformly beneficial or effective."[7]
Although pair programmers may complete a task faster than a solo programmer, the total number of man-hours increases.[2] A manager would have to balance faster completion of the work and reduced testing and debugging time against the higher cost of coding. The relative weight of these factors can vary by project and task.
The benefit of pairing is greatest on tasks that the programmers do not fully understand before they begin: that is, challenging tasks that call for creativity and sophistication, and for novices as compared to experts.[2] Pair programming could be helpful for attaining high quality and correctness on complex programming tasks, but it would also increase the development effort (cost) significantly.[7]
A study of programmers using AI assistance tools such as GitHub Copilot found that while some programmers conceived of AI assistance as similar to pair programming, in practice the use of such tools is very different in terms of the programmer experience, with the human programmer having to transition repeatedly between driver and navigator roles.[10]
Remote pair programming, also known as virtual pair programming or distributed pair programming, is pair programming in which the two programmers are in different locations,[12] working via a collaborative real-time editor, shared desktop, or a remote pair programming IDE plugin. Remote pairing introduces difficulties not present in face-to-face pairing, such as extra delays for coordination, depending more on "heavyweight" task-tracking tools instead of "lightweight" ones like index cards, and loss of verbal communication resulting in confusion and conflicts over such things as who "has the keyboard".[13]
As a student, you can generate a pairing code to link an observer to your Canvas account. You must create a separate pairing code for each observer who wants to link to your account. For more information on pairing codes, view the Pairing Codes - Frequently Asked Questions resource document.
An observer may be your parent, guardian, mentor, counselor, or another individual who needs to view your Canvas courses. Linked observers can can view and participate in certain elements of your Canvas courses. For more information on the observer role, view the Observer Visibility and Participation resource document.
There are so many stories where I feel like I'm coding through someone, and a story that would have taken me 30 minutes ends up taking 3 hours, meanwhile, I question whether the more junior devs actually learn.
The reason that's wrong is because you aren't miles away talking on a radio. You're right there and can take the keyboard at any time. It should feel like being a co-pilot. You aren't giving over control because you have to. You're doing it because you can.
One thing pair programming is not is mentoring. A teacher-stundent relationship feels very different from two people working together as equals even if one has significantly more experience. It takes time to get used to pair programming so don't worry if it feels awkward at first.
If this is all you're going to say while we pair then just take the keyboard already. Rather than spoon feed me a walk through, tell me what's going on. Why we're doing this. How I could have known to do this myself.
Also, don't just dictate the entire agenda. Carve out work I can do. Let me jump in and be part of this. Hell you may get lucky and learn something from me. The keyboard should be sliding back and forth.
True. Some need heads up time spent throwing pencils at ceiling tiles. Some need rubber duck time (a sounding board if you're of the silver hair set). Pair programming isn't for every problem all the time.
First of all, pair programming does not inherently entail tutoring or mentoring. With a sufficient seniority imbalance, you have to accept that a chunk of the time is spent on training rather than working. This should already shift your expectations of immediate results.
If you want your pair programming to be completely focused on delivery, not learning, then you have to pair equal developers with equal experience, or as close to it as you can. You're not doing this, so you're inherently either going to hamstring your seniors (by having to go at the junior's pace) or needing to instruct the juniors about the work (since it's being done at a senior's pace).
That's not pair programming, that's dictating. It's both unproductive as a delivery mechanism (it takes two people to follow one train of thought) and as a learning tool (blindly copying as you're told does not foster understanding).
I would seriously reconsider the seniority of a developer if they are only able to focus on how to fix an issue and are not able to properly guide a junior developer. That is the distinguishing difference between a junior (can do the work but needs oversight), medior (can do their own work without much oversight) and senior profile (can do their own work and provide oversight for others).
Work-related conversations are precisely the point of pair programming; it allows the pair to convey their knowledge to each other and/or helps them work together to learn something that's new to both of them.
Secondly, pair programming does not entail that both sets of eyes are looking at the same thing at the same time, all the time, and nothing else. It's perfectly possible for the senior to do something else, whether it is looking at the next task's design, reading documentation, ... while the junior performs a more trivial task where the senior is either not needed or is able to juggle both activities at the same time.
c80f0f1006