Tuesday, May 26, 2009

The Power of Pair Programming

I never wanted to sit with another developer and do my job. I know what I am doing, and google can help me figure out anything I get stuck with, right? This is my code, I know how it works, and I don't want other people messing it up.

It wasn't till I started working with a second developer at my desk for a couple hours a day till I realized the true potential and power that pair programming can bring to a team. We would lay out what we wanted to accomplish and it seemed like we always finished, never hitting road blocks or getting stuck debugging for long periods of time. We would get in "the zone" and just crank out functionality. We would knock out in two hours what could have taken me more than a day to do on my own.

There are many ways to pair with another programmer. Just sitting there while they write code and providing input as an observer. Taking turns on the keyboard with one person driving and one observing, and switching periodically. Playing ping pong, where one developer writes a failing unit test while the other follows with an implementation which causes that test to pass. There are even teams which have put together developer setups which include two keyboards and two mice such that either developer can take control at any given time without having to move over.

Pair programming can bring a team together and spread the knowledge. When a senior developer picks up an easy task, it becomes a great opportunity to pair with a new team member and use it as a teaching opportunity. It is recommended to let the junior developer drive. There is no better way to learn than doing, yet having the support of someone in the know right next to you provides a feeling of security that they can't mess it up. When the next story is taken by someone which may not have the skills to solve it, this again becomes a great opportunity for learning, but also involves team communication to find the individual which may know more about the particular component. This can greatly reduce the "truck factor" of the team.

While all the above are true, and can help justify why pair programming should be done, I must say that from my experience the biggest gain from two people working together is the focus and ability that two people have to stay on task. Working with another person typically does not allow me to be distracted. People also know better than to interrupt when people are working together in front of a computer screen. You put those two things together and a pair can get in the zone and do amazing things.

So pull up a chair and spend some time developing with a teammate.


Photo by by ntr23 via flickr.com

0 comments: