DEV Community

loading...
Cover image for Why You Should Start Pair Programming

Why You Should Start Pair Programming

Brandon Marrero πŸ‡ΊπŸ‡Έ
A kind hearted, dog loving dev. Follow me on my journey
・5 min read

Introduction

I spent a lot of time working independently, trying to build a foundation with Ruby, and scratching my head constantly. I finally had my first pair programming experience after the first month of my code boot camp at Flatiron School. That is where I met my good friend and programming partner, Austin. Things started to change. We both buckled down on Ruby labs with our loud birds chirping in the background. There were many great "ah-ha" moments.

I believe there is a lot we can do independently, but sometimes working with others can be very beneficial. In this blog post, we will discuss the benefits of pair programming and how to do it effectively. Let us start by explaining what pair programming is.

Definition

Pair programming consists of two programmers working together to solve problems. Typically, one programmer is the "driver," and the other is the "navigator." The driver is focused on the actual actions of building the application. This is the programmer that is typing on the keyboard and bringing the ideas to life. The navigator figures out which steps to take and the approach to building the application. They can also help catch errors that may go unnoticed by the driver. At times, the driver and navigator may swap roles to take a break from one role and even out the workload.

The Benefits

I believe there are three main benefits to pair programming. They are peer review, spreading the load, and engagement. All three of them can go a very long way.

High five

Peer Review

Nobody writes perfect code. If you believe that you only write "clean code" and do not need to check for errors, then it is going to come back to bite you eventually. It is essential to review your code and make sure that everything works as expected. If it is a SaaS application, then this part is even more important to ensure usability and user-friendliness. The good news is that pair programming can make the process of finding and fixing errors much easier.

You can have your navigator watch over you as you write code to catch errors in realtime. This can help improve workflow and reduce the time spent fixing errors at the end. If you are unable to work together live, then review as you go.

One way you can do this is by using Github pull requests. These allow programmers to view changes committed to the external repository, review the code line by line, and discuss changes that need to be made before pushing to the main branch.

Spreading the Load

At times, programming can feel very intimidating, especially if working independently. Depending on the project, there can be many moving parts to watch. Keeping track of syntax, algorithms, gems, and everything in between can become overwhelming. We can work more efficiently and stress-free by splitting the work with our partner. Not only will productivity increase, but also the quality because you can focus on smaller parts of the project.

Engagement

Ever spent hours on a project and felt extremely bored and unmotivated? Working with a partner is much more engaging and might help reduce those feelings. Not only do you have support, but someone to chat and bond with. Doing this can provide that much-needed humility. It also helps build trust with your partner because you are relying on them and keeping each other accountable. The projects you work on together begin to feel a lot more real.

Here are a few tools you can use to stay connected:

  • Slack: Chat rooms organized by topic, groups, audio/video, and private messaging.
  • Zoom: A conference app with audio/video meeting capabilities and screen sharing.
  • Skype: A conference app similar to Zoom, but a little less light-weight.

Effective Pairing

Pair programming can be a waste of time if it is not done efficiently. Everyone has their preferences, but I will share a few tips that have made my experience better.

Find the Right Partner

Finding a partner is sort of like dating because there is a compatibility scale. There are certain things you want to look for in a "partner." You need a partner that you can work well with, does not cross boundaries and has similar availability. It may also be a good idea to work with someone close to your level. If you are a beginner, your best pair programming partner might not be someone who has built 30 web applications.

I met my partner in my boot camp cohort, which worked out perfectly because we were on the same module and had similar skill levels. At the same time, you want your partner to bring in different perspectives from yours. Go ahead, put yourself out there!

Make a Schedule

Set time aside that is strictly for programming. We wish we could pair while binge-watching Netflix, but that does not work too well. Especially when watching Narcos, you would just miss all the subtitles.

Schedule

Be very strict in following your schedule and try not to cancel often. Making too many excuses can become tiresome for your partner and might cause them to believe you are not serious. Remember that one hour of high intensity focused work is better than four hours of less focused work. It is also much easier to find an hour to work together. Do not make your sessions too long!

Google Calendar is a great way to create a schedule that both you and your partner can view and update. Be sure the schedule works for both parties.

Switch Roles

Earlier we went over the differences between the driver and the navigator in pair programming. It is important to play both roles. Being a driver improves your skills in execution while being a navigator improves your ability to explain and break down your code. Both of these need practice.

You also need to give your partner a break from fulfilling one role. If you went on a 24-hour road trip, would you want to be the driver the entire time? Probably not. Divide the work and make things a lot more interesting and less repetitive.

One way you can do this easily is by using a Pomodoro app like TomatoTimer. It times your work sessions into 25 minute periods. You can use this timer to switch roles and take breaks. There are also many other free apps on the app store and the web.

Find a Quiet Place

It can be difficult to accomplish anything without a quiet place to work. Both you are your partner need a suitable environment free of distractions. Steer clear of the room where your three parakeets are, you will not want to be unmuting yourself every time you need to speak. I have had to do this and it distracts everyone.

Wrapping Things Up

These are just a few ways to get started on improving your pair programming experience. I hope you can utilize these tips. Do not forget to discuss your pair programming approach with your partner.


Feel free to share your approach to pair programming. What improved your experience? Did you try anything that did not work? I would love to hear your response!

Discussion (14)

Collapse
sararf22 profile image
SaraRF22

Thanks for sharing! I'm self learning web dev , so I'm not sure where I can find a pair programming partner! Is there a platforms where I can find such partners ?

Collapse
branmar97 profile image
Brandon Marrero πŸ‡ΊπŸ‡Έ Author

Hello! I believe the best way to start is to put yourself out there. I would recommend using social sites like Github, Facebook, Twitter or even DEV to find a partner. Find people with similar interests, for example, use hashtags to find people who are using the languages you are learning. Hope this helps!

Collapse
the_unconventional_coder profile image
ABHINAVA GHOSH (he/him)

@sararf22 you can try "indie hackers" if you have a project in mind and want collaborators.

Collapse
hungnguyenkt profile image
Hung Nguyen Manh

what is language, framework you find? I'm frontend dev (Vuejs)

Collapse
branmar97 profile image
Brandon Marrero πŸ‡ΊπŸ‡Έ Author

Hello, Hung! I am currently using Ruby on Rails.

Collapse
paezrice profile image
Pascal

Not trying to be rude or anything, but for completeness sake I want to show a snippet of Jonathan Blow (quite a famous indie game devloper) expressing quite the opposite of your experience, albeit a little ranty^^. Not trying to tell anyone which stance to take on this, but I think having multiple perspectives is always a great thing and this one might (or might not? i can't even tell for sure πŸ˜…) be a little underrepresented.

youtu.be/21JlBOxgGwY?t=340

Collapse
branmar97 profile image
Brandon Marrero πŸ‡ΊπŸ‡Έ Author

I agree that every take to programming has pros and cons. Many people enjoy working alone while others enjoy group work and that is perfectly okay! There are drawbacks to both. Also, all perspectives are welcome here. Thank you, Pascal!

Collapse
nandhithakamal profile image
nandhithakamal

Great post! πŸ˜ƒ
I particularly liked that you acknowledged that pair programming has a humane aspect to it. This is sometimes so hard to justify to businesses. The Engagement factor is vital and pair chemistry is quite often overlooked and doesn't get factored.

Having pair chemistry makes a huge difference in your development experience and your ease of getting accustomed to pair programming. The difference between a good pairing session and a bad pairing session is the chemistry you share with your pair. But this could quite easily become a pitfall, if you're not careful about it.

In addition to spreading the load, pair programming also greatly accelerates spreading of context/knowledge to the entire team on top of building accountability and collective ownership of the codebase. On-boarding someone to the team is much more easily accomplished through pair programming. If you're new to the team, getting familiar with the codebase can be daunting and time-consuming, particularly so if the other people on your team aren't in a position to take time off developing stories. Pair programming is a great way to get familiar and comfortable with the codebase.

I agree with you that the driver/navigator model could get tiresome/boring after a while. And I prefer the ping/pong model, mainly because we are focused on Test Driven Development (TDD). One of you would write a test, the other person writes just enough code to make the test pass and writes another test. The first person now writes just enough code to make the test pass and writes another test. This repeats until you've exhausted all possible test cases. πŸ“

Pair programming has its own share of pitfalls if done wrongly. Frequent pair switching is essential. Else you could so become accustomed to the other person's style that you start thinking alike and possibly missing out on the peer review/feedback that pair programming offers. Switch pairs often. Also, switching greatly increases agility in developing chemistry with a pair.

Collapse
branmar97 profile image
Brandon Marrero πŸ‡ΊπŸ‡Έ Author

Thank you for this well thought out response. Every pair has their own preference on how to work together. There are so many ways to go about it. I think that the driver/navigator model is great if you are new to coding. You get to practice different parts of the process as well as plenty of guidance and support. Learning how to explain your code is also practiced with this model and that can go a long way when working with teams.

Collapse
izzy profile image
Izzy-J

Good advice. I'll keep this in mind!
Thanks for sharing.

Collapse
andrewbaisden profile image
Andrew Baisden

Pair programming is a great way to learn it is like being in the same room with a teacher. Well two teachers if your level is similar.

Collapse
branmar97 profile image
Brandon Marrero πŸ‡ΊπŸ‡Έ Author

It is a great way to learn and connect if with the right person!

Collapse
allenmiller304 profile image
Allen Miller

I can’t do pair programming, some people may love it, but to me it is like I drive a car and the person next to me commenting my driving all time.

But, I don’t have this issue with the semi autonomous driving, so thinking again, I would love pair programming if the other pair is the Development Environment itself helping me to achieve the task, that will be wonderful :-)

Collapse
branmar97 profile image
Brandon Marrero πŸ‡ΊπŸ‡Έ Author

Haha. So you would be fine in a Tesla! Nice to see someone still doing smileys with the nose by the way :-)