Pair programming
So I started at Stripe this week. I did a lot of pair programming at Hacker School, and I found it super productive. As of right now, there’s no culture of pair programming at Stripe. However, Stripe is a place full of delightful people who are willing to try new things. So this past week I’ve found myself explaining why I find pairing productive.
I think some people are confused about what pair programming means. It’s pretty simple! Two humans sit down in front of the same computer, with one keyboard, and work on a Thing together. The Thing is often programming, but you can also pair on other things, like writing documentation!
Here’s a way to think about it. When you’re programming, you might ask someone to come over to your computer and talk about some code with you. Or a bug, or a design issue you’re trying to work out. Pair programming is like that, but for longer (like an hour).
A few things I like about pairing:
- You can timebox your pairing sessions, and have a specific goal: “We’re going to work for 1 hour on refactoring this library”.
- Explaining your code to someone makes you understand it better.
- Pairing on a boring task makes it way more fun. If you have a gnarly bug that you don’t want to fix, work on it with someone new to the codebase! They’ll learn something, and you’ll have company.
- Pairing is a good way to share knowledge. I get a lot of incidental learning out of pairing with people, seeing things they do that are new to me, and asking them questions.
- It keeps you honest. You can’t just stop coding and go look at cats when you’re pairing. (You actually can, but you both have to agree to go look at cats together.)
It’s definitely possible to have pairing sessions that go badly, of course. Hacker School’s excellent advice on pairing suggests
It’s good to make sure you have similar (or at least compatible) goals before you start pairing. If one person thinks the goal is to learn Python, and the other thinks the goal is to fix a bug as quickly as possible, you can run into friction.
Basically I think pair programming is a fun time, I usually end up writing better code than I would have on my own, and I learn a lot. Some people like Pivotal Labs pair like 8 hours a day, but you don’t have to do that! Pairing a little bit is a super fun thing.