Pair Programming

Pair programming (sometimes referred to as peer programming) is an agile software development technique in which two programmers work as a pair together on one workstation. One, the driver, writes code while the other, the observer, pointer or navigator, reviews each line of code as it is typed in. The two programmers switch roles frequently.

Benefits of Pairing:

  • Improves Quality – Better code
  • Increased discipline – Resilient flow in working
  • Improved morale
  • Collective code ownership
  • Mentoring
  • Team cohesion
  • Fewer interruptions
Pair Programming Concept
Pair Programming Concept

Guidelines for Pair Programming:

Fair Play –  One person “drives” (he has control of the keyboard or is recording design ideas) while the other is continuously reviewing the work and planning ahead. Stay fairly close to 50-50 on driving.  Let the less experienced partner start and maybe drive a little more. Say you’re sorry when you hurt somebody; sit side-by-side and program, simultaneously viewing the computer screen and sharing the keyboard and mouse.  Slide the keyboard — don’t move the chairs. Also, make sure there’s enough space for both of you to sit comfortably. It helps tremendously if you reduce the barriers to both people contributing.

 

Communication is the key – The real trick to effective pairing is communicating. Get in the habit (especially when pairing with someone new) of thinking out loud. Talk about what you’re going to do, what you’re doing and what you just did. This makes sure both you and your pair are on the same page. As a bonus you’ll often discover problems with your approaches when you try to describe them. A good rule of thumb is that at any moment you should be able to stop typing and your pair should be able to take over.

 

Don’t take things too seriously.  If your partner picks out a bunch of errors as you type, be glad.  But do not always agree.  Have healthy disagreement/debate.  Finding the fine balance takes adjustment. Make sure you leave your ego out of it. – It can be really uncomfortable to have someone watch you make mistakes and typos all day long. You have to learn to stop thinking of things as “My code” or “Your mistakes” and switch to thinking of yourself as part of a team.

 

Mind Game – Put negative judgments in the trash:  Be positive about you and your partner.  For both, this is an opportunity to improve. Also clean up your mess.   – You are really likely to find a large number of your errors – think like – grass is always greener on the other side J

If you work on some parts independently either discard them (flush) and start over together or have the partner very carefully review the work with you.

Periodically, taking a break is important for maintaining the stamina for another round of productive pair programming.

 

Share your tools. Agree on development environment and tools before you start. Having a machine that neither of you owns can be really effective. This prevents one person from being constrained due to a lack of familiarity with how things are set up.

 

Focus  But make sure your partner stays focused and on-task. Set aside time to do it. It’s really hard to pair with someone when you both get interrupted for meetings or interviews or to check email. You should treat your pairing time as focused work time. Make sure you don’t have anything scheduled and put away your laptop and phone.

 

Experiences show that, together, a pair will come up with more than twice as many possible solutions than the two would have working alone. They will then proceed to more quickly narrow in on the “best” solution and will implement it more quickly and with better quality. Be aware of the power of two brains.

Our Latest Blogs
Privacy Preferences
When you visit our website, it may store information through your browser from specific services, usually in form of cookies. Here you can change your privacy preferences. Please note that blocking some types of cookies may impact your experience on our website and the services we offer.