Wednesday, July 21, 2010

Why I like pair programming (and why I'm not leaving)

A few friends have pointed out a blog post from someone who recently left Pivotal Labs due to the fact that he didn't enjoy pair programming full time. (It's well worth the few minutes of time to go read it.)

I read through a bunch of the comments on the blog and the linking reddit page and most of them started as "Well I've never done paired programming but..." or "That's stupid! I did pair programming once and...", so I figured I would write up my own reply as someone who has done pair programming full time for around 4 months now.

Mark's post has gotten me thinking a lot about the whole pairing thing and whether it is all that it's cracked up to be. I'm always trying to reevaluate the practices and techniques I'm using, even if I do work for a place that has mandatory pairing on my agenda. (For the record, a few months ago there was a company wide forum where everyone reevaluated as well. The result was nearly unanimous for pairing full time.)

One of the biggest arguments that I heard from the post was that pairing doesn't allow for that sort of reflective, meditative approach to programming. You know, those times when you have a big problem in front of you and you need to spend at least an hour or more thinking about it and coming up with a wonderfully elegant solution. Some people are better at this than others, and Mike seems to be one of them.

In fact, my biggest challenge with pairing is probably the same thing. I like to think I'm pretty good at that technique myself, and I've had my share of cool ideas that have paid off from doing things that way.

However, something just doesn't sit right with me about that. Sure, that lone ranger style of coding can be a lot of fun, and you can feel very proud of your results at the end, but I've found that when pairing you almost always arrive at solutions that are just as good, and often better the first time around than doing them by yourself.

Just last week, my pair and I had a problem where I had a vision of how I thought a part of our system should work out. Part of me was screaming, "I know how to do this... I don't want to explain it, I just want to go off and do it by myself and get him to review it when I'm done!" However, because I was pairing, I found that my pair had some great insight into the problem, and, even though the vision was still mine, the end result came out way better than it would have if I had done it on my own (and I learned a lot from my pair along the way!)

I think that we often overestimate how well we do things the first time. Looking back at some of the code I've been the most proud of, I could convince myself I do it great the first time around. But the reality is nearly every single one of those things has been through a number of revisions that has gotten the code to the state it is in today. Had I paired on those features, I'm sure they would have ended up in a better place more quickly.

Ultimately, I think the pill I've had to swallow about this has been to give up the self for the greater good. As I mentioned, it can be a lot of fun and feel very rewarding to go off and do some meditative programming, but is that what is really best for the project? For the team? For your client? Yes, great things can come from that, but I've seen time and time again that you get to a better place faster by pairing. You also spread knowledge between team members faster, write fewer bugs, and generally stay more on course by writing less unnecessary code.

Additionally, I find the extra knowledge and learning I get from pairing helps make up for the lack of satisfaction I used to get from being the lone coder. There are many ways to collect paychecks as a programmer, and I can't fault someone like Mark deciding pairing isn't how they want to do it. But for now, I've decided to try to give up a bit of my pride, drink the kool-aid, and embrace pairing and the team centric atmosphere it creates. I can't ignore the results I see every single day of being more productive and having a better product to show for my efforts. Obviously you will have to make your own decisions for yourself.

P.S. Here's another post from a Pivotal person on the same topic. Also worth a read.

1 comment:

  1. Hey Ian - you are talking about some pretty significant and even spiritual concepts here - giving up your own ego for the sake of others! Powerful stuff! What if we could learn to "pair" in all our relationships!

    ReplyDelete