Pair programming: why does it work?

Let's talk about pair programming (or binômage / pair programming)! This technique, in which two developers work together on the same computer, is like a two-person choreography, where one is the pilot and the other the co-pilot. It's as if Batman needed Robin to write code.

There are many advantages to this technique, even if it may seem a little odd to work so closely with someone else, in a profession that has a reputation for being a solitary one.

How does a pair programming session programming session?

Two developers can decide to hold a peer programming sessionon a one-off basis to resolve a bug or develop a feature, or on a regular basis, for example by setting aside half a day each week.

The driver is the person holding the keyboard and mouse. He will be the only one to communicate with the machine. The co-pilot will be next to him, without touching the code. The two pairs will alternate roles several times during the same session.

This exercise is as stimulating for the pilot as it is for the co-pilot. While the pilot executes the task in an almost mechanical way, the co-pilot steps back and contributes his thoughts to the creation of the code. The co-pilot expresses an intention or an indication, while the pilot implements a concrete solution based on lines of code.

Contrary to what one might imagine, it's not all plain sailing for the co-pilot. Programming in pairs is a demanding and testing exercise. It's almost an art of collaboration that takes practice.

Alone we go faster, together we go further

First and foremost, peer programmingimproves code quality. With four eyes on the editor, there's less risk of errors, and problems are identified quickly. This means the team spends less time debugging, and more time writing a quality program.

Secondly, programming in pairs means sharing knowledge: both partners have experienced the same difficulties, found solutions together, and acquired the same technical experience. They progress not only individually, but above all collectively on the project.

Speaking of shared understanding, peer programming can also reduce ramp-up time for new team members. A newcomer to the team can understand the source code faster and become productive more quickly than if he were left to his own devices.

But that's not all! Twinning increases the speed of development of the entire project. Whenever there's a stumbling block, the pair can step in straight away and move the project forward without wasting any time. And it's also a great way of motivating each other: there's no question of scrolling through Instagram when your partner is in the other room.

Finally, working in a duo forces you to improve your communication skills. No wonder: working closely with someone builds stronger relationships. This naturally leads to a close-knit team over the long term. Each member knows the strengths and weaknesses of the other.

And there's another major advantage: peer programming replaces traditional code reviews. The co-pilot examines the code as it is being written, enabling immediate and more in-depth feedback. The pair concentrates on writing quality code rather than fixing errors after the fact.

Communication, the key to pair programming

Working in pairs is like being in a romantic relationship, with its ups and downs. Peer programming is an investment of time and energy.

First of all, following another person's ideas isn't always natural when you feel you're an expert in your field. Let's not forget that, as in any relationship, there can be misunderstandings and differences of opinion that can lead to friction.

On the other hand, working in pairs can lead to a feeling of loss of autonomy, especially for developers who are used to exercising their talents on their own. Working with a partner means agreeing on decisions andaccepting compromises. This can be difficult when you're in this profession for the creative freedom it gives you.

So, as you may have guessed, communication is the key to making this work. So the important thing is to find a compatible partner and always communicate with kindness.

A question of exchanging goodwill

Pair programming takes practice, but it's worth it for a multitude of reasons. Especially for the employer or customer. Studies have shown that programmers who work in pairs are more self-confident, more productive and, above all, more motivated in their work.

In the end, the conclusion is simple. If you're a manager whose mission is to have a close-knit, productive team, or if you're a developer who's tired of "dealing with Jira tickets all day long", chances are you'll enjoy peer programming.

At 5 DEGRES we recruit talented developers at all levels and in many languages. Who knows, you might find your next programming Robin with us... or become one?

Picture of Arthur Pietruch

Arthur Pietruch

Web Development Consultant & Practice Leader Product Development

Share this article

Share this article

Contents

Read also

Read the article
Read the article
Read the article