The best part of pair-programming is when things go wrong

I’ve pair-programmed in a lot of different situations. I’ve been the junior developer who needed to be unblocked. I’ve been the new team member, being onboarded to a new codebase. I’ve paired with peers for knowledge-sharing and productivity. And I’ve been the senior dev.

When you’re about to pair-program, there’s a temptation to plan it around a simple, self-contained task… one that’s unlikely to have any surprises or unknowns. Nobody wants to feel embarrassed getting stuck on an unexpected problem when your peers are watching.

Taken to an extreme, your pair-programming sessions can start to look like a perfectly planned cooking show with pre-measured ingredients, lined up in the correct order. You get a flawless cake every time but you don’t learn anything useful about baking.

When I think back, my favorite pair-programming sessions were the one where things went wrong. These were the moments that taught me what being a programmer is all about. What do you do when you don’t know what to do? How do you break down a new problem? What tools do you reach for? When do you abandon your current approach? These are things you can’t learn from a blog post.

Even just the idea that senior devs have knowledge gaps, google things, and make mistakes was a revelation to me. I started to see that senior devs are a lot like junior devs, but with more confidence, better instincts, and a well-rounded perspective. These were valuable lessons for me as I transitioned into a senior dev myself.

It takes some courage to jump into an unknown pair-programming situation but don’t be afraid! A lot of good can come from working through a messy problem together.