Pair Programming – One of the more advanced software development techniques you should know.

Tram Ho

Hello everyone, this is Hoang, today we come back with a pretty good topic that not everyone knows. A topic that has nothing to do with code, but to help your level grow.

Not too wordy anymore, it was pair programming


Follow me to answer the following questions, so that you can understand what pair programming is

  1. What is pair programming?
  2. What can pair programming do?
  3. Implementation of pair programming
  4. When to use, and some points to note
  5. Conclusion, my own opinion.

What is pair programming?

Pair programing, also known as pairing, programming in pair is basically a software development technique. It is often seen that 2 individuals do the same task on the same computer.

Since then, there are 2 respective roles: Driver and Navigator , Driver is responsible for writing code, while the job of the navigator is to monitor the driver, give advice and try to understand and convey the overall picture of the task. that for the driver. These two roles can be interchangeable in regular intervals.

Pair programing do? (benefit)

In my opinion, benefits are divided by 2 objects: People and Projects


  • Improved teamwork problem . When pairing code, we should , or put it more heavily, we need to talk . This really helps the members understand each other better, from there the teamwork issue is also enhanced.
  • Improve each person’s skills better . When pairing code, we will get different perspectives from the two people, as well as different knowledge and techniques to exchange. Especially if you were pairing the same code by someone of a higher level. => The skills of the whole team are developed together.
  • The members ‘ concentration , confidence and satisfaction have been greatly improved. We can see that, if someone pair code with us, we will be less distracted, less check fb, instagram, .. because we don’t want to disappoint our companion so the concentration is sure. will definitely improve. And being coded with others like that can make you more interesting, more fun => improves your satisfaction better. And you will gradually become more confident in yourself and in the knowledge you have.
  • Increase problem solving ability . Have you ever heard of the Rubber Ducking technique – explain to the duck its code. When pairing the code, we need to explain our code to the companion. This also gives the same results as Rubber Ducking => helps you understand and possibly will be able to solve the problem that you did not expect.


  • The code quality of the project is improved (less buggy code, more unit test, cleaner code). Why is that? Simply put, 2 heads are usually more than 1 head. When we pair the code together, we can easily spot each other’s flaws, come up with a better way to solve problems, etc.
  • Time to deal better . Strangely, usually one job per person will be faster than 2 people, right. But in fact, for pair programing helps solve the work faster. For a difficult task, having 2 people thinking the same thing will be much faster for one person.
  • When we pair the code, we will understand the project better , which is very important, it helps the project to develop significantly faster .

=> From the above, we can conclude here that pair programing helps the project work better, saves time and costs .

How to perform pair programming?

We can divide it into 2 categories: Level and Type


  1. People with more experience – people with less experience (such as senior – junior, junior – fresher, …). This seems to be a great combination to speed up learning for you with lower levels. It’s also a good way to share experience across the team, but pay attention to the balance. For example a junior-senior pairing, if not good then a junior is just watching until the end of the task. Can’t absorb anything. Or a senior may feel uncomfortable when his speed is slowing down when he has to explain to a junior for example.
  2. The person has the same level of level (which can be understood as junior – junior, …). This combination also significantly improves productivity and quality. Because their qualifications are the same, but there is one who knows, the other doesn’t, …


Driver-navigator is the most commonly seen type, the two change roles => so that output is the best result. But also encountered some difficulties as follows

  • The driver concentrates the code, and the navigator doesn’t want to disturb
  • Or when the driver says “wait a minute” => Nagivator will be free and most likely it will be distracted by checking fb, instagram, ….

In general, for pair programing to be successful, the key is mutual respect and communication between the two. Unfortunately, this is often difficult to do with new pairs.

There are a number of other techniques that I think should start from there for new pairs as follows

Strong & Traditional Pairing Techniques

The guideline of this technique is “Driver will do nothing until navigator guidance”.

Whenever the driver asks the navigator to explain an idea, the navigator needs to make it clear, and then simply return to the viewing position.

Ping-Pong Pairing

This technique is commonly used when dealing with unit tests. Start with the first person writing a test fail, and passing it on to person 2, the second person will have to complete that test fail, also write another test fail and pass it on to person 1. repeat until coverage is covered.

When to use, and some points to note

When to use?

As far as I can see, we will use pair programming in the following cases:

  • When there is a complicated task, or a PR too big.
  • When coaching
  • When fixing
  • Or simply want to raise the level of members in the team.

Taking this paragraph together, find the right time to use it , starting with the time suggested as above . Once you have an experience with this, don’t hesitate to suggest to use it when needed.


  • To be fair, remember the roles of the two are the same.
  • Lower ego, respect each other and absorb each other’s opinion.
  • Please trust your companion .
  • Don’t force it
  • Give your partner the opportunity to “drive” at the right time
  • Encourage open communication.
  • Do not skip rest periods
  • Identify your mistakes
  • Get the error first
  • Calm down, don’t rush

While paring , we have the following points to note

  • Let me code it for you
  • Can you help me ?
  • Let’s have fun together
  • I intend to follow this direction, what do you think about it?
  • Do you have any solutions?
  • How does this code run, let’s write a unit test.
  • I don’t understand what you mean, can you explain it more clearly?
  • Heeyyy, have we forgotten anything?

Take a break

  • Let’s take a break
  • Hey, I think I should change roles
  • Yoo, let’s make a cup of coffee.

Conclusion, my own opinion.

In fact, pairing has many benefits. So the benefits of paring are undeniable.

But, is pair programming right for everyone? The answer is really not that simple to this problem. We’re all different, so for sure there will be different results. Pair programing works very well for some people, but not for some.

Remember, pair programing is not suitable for every project

In my opinion, the method itself was the same, there was no good or bad, it was simply appropriate in the moment or not. Pair programing is the same. But remember, if you don’t try it, how will you know ?

Finally, thank you for reading to the end. Any ideas, please comment below.

Please support me with upvote. So I can improve and come up with new, better articles.

Share the news now

Source : Viblo