logo
logo
Sign in

Pair programming: what is it and is it shameful. 9 questions about pair programming

avatar
Markus Doronin
Pair programming: what is it and is it shameful. 9 questions about pair programming


There is a practice of pair programming in IT. Here's how it works, why you need it, and what to prepare for.


What is pair programming?


Pair programming is when two programmers work simultaneously on code: one writes and the other comments aloud. The second one can notice a mistake or suggest a faster algorithm. At the same time, he/she cannot correct anything; it is the task of the first one to do so.


Then the programmers switch places: the observer starts to write the code, and the presenter starts to comment.


Why is it needed?


Pair programming is for productivity and mutual learning. The observer penetrates into the code, follows the thought process, and is constantly looking for something to complain about. At the same time, he or she learns new techniques.


The presenter also works at a different pace than usual: He says out loud why he is writing each line of code. A side effect is that by saying his decisions aloud, the programmer may notice a mistake himself.


Wouldn't it be better to write code in pairs?


It seems that pair programming is inefficient because two people are solving a problem that could have been solved by one person alone. But direct code writing in programming takes one-tenth of the time. The remaining 90% of the time, the programmer is looking for the best solution - and here paired programming helps significantly speed up the work.


In pair programming, two people think about the same problem and share ideas with each other immediately. What two programmers alone will take two days to accomplish, they can do in pairs in a few hours.


How are the pairs selected?


This is the most difficult thing in pair programming - to find a pair in which it will be comfortable to work. The fact is that paired programming can last up to 4 hours, and it is difficult to sit that long with someone you are not comfortable with. Therefore, when selecting pairs, managers try to take everything into account: Who is a team leader (aka Lead)


  • temperament - a cheerful programmer will be difficult to work with a taciturn and uncommunicative colleague;
  • Speed of speech - so that the one who speaks quickly will not be annoyed by the slow speech of the other;
  • programming style and specialization - so that colleagues are useful to each other;
  • and anything else that might prevent two programmers from working together.


Is there specialization in pair programming?


Yes. Some pairs are successful at solving complex problems that no one knows how to approach. Others are good at finding errors in other people's code and refactoring. Others are best at handling concepts and prototypes when you need a working solution quickly.


What are the advantages of pair programming?

✅ Two people can solve the same problem faster than one at a time, but one at a time.


✅ There are far fewer bugs in the code, and it requires almost no code review or refactoring.


✅ By observing the code and thinking style of another programmer, you can learn new things yourself.


✅ Pair programming often helps to solve problems that seemed unsolvable.


Disadvantages of pair programming


❌ It is very resource-intensive for both - few people manage to work in pairs for more than 4 hours a day, usually an hour or two.


❌ The programmers should have roughly the same qualifications.


❌ It's hard to find a pair for comfortable programming right away, and sometimes a person is basically incapable of working with someone in a pair.


What can go wrong?


The most common mistake is when one writes code while the other sits silently or is dumb on the phone. This is no longer pair programming.


When both are remote, it can be difficult to build rapport, even if you've worked well in the office before. It's easy for the presenter to get carried away and start writing code on their own without looking back at the other person.


I want to pair programming, where do I start?


It's simple:


  • Learn any programming language at least at a junior level. For example, you can free online courses here.
  • In a chat room, on a forum, or among acquaintances find someone with whom you would like to code in a couple.
  • Try it. There are no magic recipes, everything comes with experience



collect
0
avatar
Markus Doronin
guide
Zupyak is the world’s largest content marketing community, with over 400 000 members and 3 million articles. Explore and get your content discovered.
Read more