Pair programming is the fastest way to upskill

Learn how to pair

Photo from the National Women’s History Museum.

By now, I have heard several excuses from developers and managers who had their reasons not to pair program. As far as I’ve seen, the doubts and inhibitions arise from experiences involving bad practices.

Two of the earliest ENIAC engineers, Jean Bartik and Betty Snyder were a pair in the 1940s when they worked on the first ENIAC machines. “I believe that the best programs and designs are done by pairs, because you can criticise each other, and find each other’s errors, and use the best ideas,” Bartik said.

If two of the early programmers in the history of computer science could pair, so can you.

Once you master the skill, pair programming can be rewarding and starts to become more fun. Trust me when I say that pair programming works for everyone. You just have to find the style that works for you and your partner.

So, if you are new to this and find pairing intimidating, start small. Start with a small bug or a task that is simple to achieve. The next step would be to pick a personable developer you know to pair with. When you start out, it helps to pair with nicer, communicative people. Lastly, remember that people aren’t mind readers, so be communicative yourself and think out loud as much as possible.

In this article, I’ve listed some basic requirements to have a successful pair programming session.

Review Your Setup

Using a setup that is not ergonomically friendly can be physically stressful and demotivate you from pairing.

A good setup can go a long way. You want to make it as easy as possible to pair. So first things first, get your setup right. An ideal setup has one computer, two keyboards, two mice, and one monitor (or two mirrored monitors). Try to plug in only one keyboard at a time, but have your personal mouse and keyboards. If you want to learn more, I wrote about the setup in detail in another article.

Have a good font size that is convenient for both of you and try not to hog the monitor or keyboard. Let the driver do the job of typing. If you feel the urge to type often, having a strategy beforehand for switching pairs using Ping Pong is a great idea.

Timebox the Session

Pre-deciding how long you want to pair will help you schedule your task more efficiently. Decide on a time management technique like Pomodoro and time intervals. For some, 25 minutes could be a decent interval, but some could go on until 45 minutes.

Whatever your choice, try to not go overboard. Have a timer and stop immediately regardless of the state of the task. During the session, have complete focus away from distractions. The added benefit of timeboxing and pairing is that you will start valuing that time even more, as it’s not just your time that you’d waste during distractions.

Pre-Install Required Tools

Be prepared to pair by learning the required tools you might need during the pairing session. Inappropriate tools can cause inconveniences. If you are using a relatively new tool like Git, Vim, etc., take some time to familiarise yourself before pairing. Learning IDE shortcuts can improve your productivity and save a lot of time for both of you.

If you can use the tools efficiently, it will help boost confidence, which is imperative to having a satisfactory pairing session.

For remote pairing, try to install all the required apps that can make your pairing smoother before the session. Be prepared!

Use a Template

A pair programming session can be treated like a meeting. A template with basic guidelines is like setting an agenda for the meeting. Then both parties know what to expect from the session. Deciding on a template beforehand can save you the trouble of setting an agenda every time you meet with multiple devs.

You can definitely discuss any variations depending on personal preferences with every pair, but the majority of the parts should still work. For instance, my template looks like this:

  1. Start with checking about the schedule with my pair.
  2. Timebox one or two sessions based on the problem at hand that are separated by breaks.
  3. Pick a method if not pre-decided like Ping Pong, Pomodoro, etc.
  4. Speak out the problem and make sure both of us understand the problem correctly.
  5. Discuss approaches and decide to go with the optimal one.
  6. Break after the time is up and switch roles.
  7. Repeat and end with a mini retro.

Decide on a Time Slot

Block some time for development in your calendar. Start when you feel fresh. Early mornings when you come into work are the best times for pairing. Research shows it is most productive to schedule creative activities in the mornings when your brain is well-rested.

Try to block a time slot that is not squished between meetings. A bigger chunk — somewhere between an hour to three hours — will get a lot of stuff done. Do not pair continuously for five hours or an entire day. It might not be as productive as blocking two chunks of two hours each with longer breaks.

Avoid pairing immediately after lunch or late in the evenings when fatigue builds up. Also, it is OK to say, “I’m tired and want to continue another time” if you are unable to pair anymore.

Take Adequate Breaks

Do not get lost in the flow and forget to take breaks. Avoid long hours of pairing, as it requires intense focus and can drain you very quickly.

If your pair doesn’t stop to take breaks, remind them to. Break mandatorily after each interval. Research says it is important to break frequently and revisit the concept to generate creative ideas.

It is also a proven fact that intermittent breaks to allow brains to switch between focused and diffuse modes can be much more beneficial in creative tasks to generate better ideas than working long hours.

Focus on Cleanliness

Firstly, take good care of your personal hygiene. Maintain adequate distance to be mindful of each other’s personal space. Have an arm’s distance between one another.

Pop a fresh mint before you start. Everyone knows how bad breath can drive people away. Pair programming with people who stink or have bad breath can cause discomfort. Most people just tolerate such poor hygiene problems, as pointing them out to a colleague could give rise to conflicts. So go a step ahead and be mindful.

Have dedicated keyboards and mice. Clean the setup with sanitized paper towels before starting.

Lastly, declutter your desk. A clean desk can help you think clearly.

Have a Mini Retro

Finally, it’s time to celebrate a good day’s work. Always end your pairing session with a mini retro. If you don’t want to make it so formal, then just ask your pair how they found the pairing session. Talk about what went well and what could be improved in the next sessions.

Do not forget to emphasize your achievements with high fives, etc. These are little power poses that keep the motivation flowing. Celebrating small milestones helps in ending a day on a good note, which is paramount to having good team morale.

Conclusion

At the end of the day, if something is not done right, it can turn into a monstrosity soon. But it is important to remember it is the technique that needs improvement. Try not to dismiss the idea only because it didn’t work with someone who didn’t know to pair. It is not worth giving up entirely. Like any other skill, pair programming techniques can be learned and developed with time, effort, and regular iterations.

In more than a decade of my career, I found the easiest and fastest way to learn quickly and effectively is by pairing. If it scares you, stop overthinking and just get started. After all, there’s nothing to lose.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s