247 points · by _ttg · 4y ago · 131 comments
I think ultimately, at the end of the day, I expect and hope that every human I work with is a competent, solid individual contributor and does not require a co-driver to produce meaningful work.
I definitely see the value in pairing for imbalanced situations (junior and senior, new engineer and tenured), but such sessions should have the goal of getting each person to operate independently, hopefully sooner than later.
Pairing just for the sake of pairing is an encroachment on many things I love about software (the ability to think about a problem deeply and quietly, the ability to work independently, the ability to check my Twitter feed as often as I damn please). I’m really glad the pairing fad seems to be dying down in general!
IMO this is a very wrong way to look at pairing. It's not about one person being incapable of delivering a solution on their own, it's that having multiple perspectives on the code will lead to a higher quality and more well designed product.
You could use the same argument you're using to say we shouldn't do code reviews, because we should trust that every developer is competent.
Also, at least in my experience, design isn't primarily or even mostly confined to an initial design phase. Most of the 'design' of a problem occurs when you're actually coding.
Fundamentally I tend to think that people who insist pairing is ok to impose on people think everyone is like them, and don't see that it's forcing out people with different ways of thinking and processing problems. Ultimately I think it's bordering on discriminatory in that it's selecting for extroverts who don't burn out by the extensive amount of interpersonal contact pairing forces rather than selecting for results.
For my part I will never work somewhere that imposes pairing. I'd rather leave software development altogether than suffer through that, because it's not worth the exhaustion and the reduction in throughput other than occasionally (e.g. while training someone or walking people through a prototype). Thankfully I have the luxury of not having to take that shit.
I think it's one of those things where some people are good at it / enjoy it. Some people don't.
As a paradigm, I think pairing is better. Two talented, smart people who are able to work together will produce a better solution than one person alone. As you rotate pairs, context on the code base is shared and permeates the team faster. New onboards get up to speed at a remarkable pace--far better than the "uhhh so checkout the code. Mess around, see if you can get things running. Idk good luck" process I usually see on non-pairing teams.
I've seen a lot of code over the years developed in silos by talented people. The work gets done. But the teams I've been on that embrace pairing produce better code, the team has better shared context, and there's a real joy to the work. This becomes disrupted when someone who does not like pairing joins the team, and actively resists the process, hoarding context and cowboy-ing solutions off on their own.
If I ever run a company, I will select for engineers who aren't just comfortable with pairing, but actively enjoy it.
I think companies can perfectly well operate with lone wolf engineers. But you have to add a lot of process to wrap that mentality--code reviews, design sessions, context share-outs, multiple people singing off on PRs. These are things you can largely do away with if you're doing pairing correctly.
From my experience, it's just better. But hey, I'm biased. I'm one of those people that enjoy it.
I also find that getting stuck alone on a problem kicks me into a procrastination spiral whereas I tend to find it easier to push on when I'm stuck with someone. It also helps prevent me from getting into a spiral of second guessing every technical decision ive made in the last month.
I dont really think people take to pairing or not on the basis of its prima facie effectiveness though, but rather whether they enjoy programming as a solitary or social activity.
Really, I think teams should be set up to ensure people who like pairing to be together and vice versa, coz i feel just as miserable working alone all day every day as you do pairing.
The problem is that in the tech biz people tend to follow blindly without thinking. There was a point there where just because Pivotal Labs had some success pairing full time, everyone followed blindly. It’s the same with leetcode style interviews, open offices and ping pong tables - it worked for google and all of the sudden everyone is following blindly.
But personally, I wouldn’t work somewhere which paired heavily even if the benefits could be proved. I simply won’t do it because I don’t enjoy it!
Just like the choice to work remotely, the choice to not pair seems like a basic employee freedom that we should all have. Luckily, the way our industry is moving, such freedoms seem to be increasing.
Pairing was highly encouraged in my previous job. We did it for 5 or so years, even when working remotely using tmux. In my last 2 years there, in an attempt to increase throughput / save time, pairing became something you only do for crucial task.
I could argue that the code quality declined as well as the distribution of knowledge while not seeing significant increase in throughput of work done. Even more, and due to knowledge sharing, code review time increased.
I recently asked a friend who's a team lead at a FAANG company if and how they do pair programming. His answer was that it is not encouraged, mostly because "performance reviews assess contribution of individuals, and pairing would disrupt this process".
Will it though, when those multiple perspectives are enforced through pair programming?
Like a lot of agile cargo-culting, pair programming often seems like software development for extroverts. Those of us who are introverts, and got into software development because it's interesting work which suits our temperaments, don't necessarily appreciate this... at all. I'm not saying I'm unwilling to work with others, or figure out problems together - I have to do this all the time, we all do - but I prefer to program alone.
I think a developer has to earn that privilege. Often times developers use the "just let me do my own thing by myself" line to push code they know is crap, just because they don't get the same level of scrutiny and accountability through an asynchronous code review. Asynchronously, the code reviewer isn't easily able to see the author's thought processes as they constructed their code, so they don't really know whether the author's way of solving the problem is reasonable given the context without putting in significantly more effort into reading the entire context in which the change was written.
After having dealt with mountains and mountains of technical debt in my career, I'm firmly of the opinion that every developer should go through a period of pair programming with a more senior developer. Maybe they can do it for their first quarter with the company. At that point, if the senior developer signs off, they can acquire the right to code independently if they so desire.
That's what PRs are for. One can't use the same argument to oppose PRs, as you suggest, because of this key difference: in a PR, the person doing the review has (or ought to have) context on the broader picture (e.g. overall architecture, structure of the code in which the change is being made, etc.), but not the specific changes. It's analogous to having a proof reader: one doesn't invite a peer author to review his writings, because the peer has an implicit bias and can easily miss defects.
"Also, at least in my experience, design isn't primarily or even mostly confined to an initial design phase. Most of the 'design' of a problem occurs when you're actually coding."
This is common, unfortunately, and one of the primary reasons software is so buggy and overly complex. The code isn't the design, or shouldn't be. To draw an analogy to physical/industrial processes, the code is the machinery on the factory floor doing the work--the design is what was used as a blueprint to construct that machinery.
You generally want domain expertise shared in a team, and continuously molded to perfection over time.
Mobs and pairs can really shine here, but it all depends on the individuals.
In teams where it works well it’s an enormous value add, in my experience, and the hive mind you reach after a year or two within a team is fantastic.
As a dev manager I let the teams decide, but looking at team flow over time, it looks hard to beat a well functioning pair or mob team. IMHO & YMMV, and so on.
- knowledge sharing, especially business, domain, old code, etc. The biggest stopper in writing software in large organizations is rarely technical difficulty but context
- focus. If I'm alone I get distracted much more, music, youtube, socials, I know this is on me, but getting distracted while pairing is hard and rude. I'm also much more organized and a coworker is much better than a rubber duck.
cons:
- you are blocked from working if a coworkers schedule is not aligned
Overall I think pair programming makes in my, and most organizations produce more work than if the contributors where solo programming.
I think this is the key takeaway with one missed point. IMO it definitely does produce more work vs. solo programming but that work is sub-par. The necessary time isn't spent thinking on the tasks but instead the pairing rushing things through with very little thought to design and long term maintainability.
Later, when I’m alone and can focus the proper answer usually comes to me. I know there are others like me who produce their best work when they can focus, alone.
If pairing works for you, then that’s great, but it needs to be consensual and optional.
The problem with pairing is that it tends to be championed and enforced by more social workers (especially managers), and forced on the less social ones, who are often not in a position to refuse.
Indeed, and this is a problem that can affect other “Agile” practices too. Mandatory/permanent pairing is one example. TDD is another. Both can reflect a more general trend to try to break development down into tiny steps.
It’s not that there is no value in developers working together in real time, or in unit tests, or in incremental development and short feedback loops. All of these can be very useful. In my experience, they are often adopted spontaneously by developers even if there is no formal process in place that requires them.
But it’s also important to look at the big picture. You need a coherent vision for the product. You need a consistent domain model that is well understood and shared by both developers and non-developers. You need a reasonable software architecture that provides useful patterns and abstractions but also isn’t afraid to change them as requirements evolve.
Without these things, it’s easy to take a lot of small steps and create an illusion of progress, yet not move efficiently towards your true goal. Increasingly serious problems tend to get shoved under the carpet (sorry, “added to the backlog” or “labelled as tech debt”) until inevitably quality and productivity start to suffer.
You can’t fix those kinds of problems working in the small with only one or two participants.
I know it's anecdotal but this doesn't happen in my team. Our pairing culture isn't oriented at producing more but higher quality code, and it generally tends to achieve both.
Or, to turn it around, rushing tasks doesn't seem to be an issue of solo vs pair or mob programming.
I feel like pairing pushes people towards this because both parties feel the need to show they aren't "wasting time" by engines reasonable definition of it.
If you swim upstream and try to work against this, it can cause some friction.
Con: you're spending literally double on engineers for the same amount of work done
The two big ones that will make me hate pair programming with you: Leaping on errors too quickly and giving low-level instructions.
The big sin I commit: Driving too fast
When pair programming is going well, it really does speed up development time and increases the amount of people who know about a section of a codebase which is always good. But when it's bad, it's really really bad.
The majority of developers, in enterprise at least, tend to write the first piece of code that enters their head, and they only consider the immediate problem. The code Just Works, so pairing is sufficient for them.
Whenever I've driven a pair session, I tend to go back and finish it - fill in the blanks: handle edge cases, tests, security, a11y, etc.
Pairing is a good tool for creating prototypes or combining ideas, and in imbalanced situations like you say. But for long-term stable production, code reviews are generally more suitable.
And there are some partners you will simply be unable to pair with unless both of you take the time to give each other significant space/time. (ugghh..that sounds like some corny relationship therapy).
But when it's going smoothly, wow, you can code large blocks of code in a few sessions and the structure/design of code comes out looking really good. You can refine each others ideas as you code or even arrive at something better when the flaws are pointed out in the individual approaches.
I have also tried tri-programming also where a third guy joins in for miscellaneous stuff like quick exploration, how-to-do-that's or research activity while the primary pair focuses on the main backlog. This is helpful because when you are in the groove, you really don't want to get side-tracked.
I am a social, introverted recluse and even I found pair-programming objectively useful.
It all sucks doing it remotely though and frankly not worth it.
I find this perspective wild. I cannot possibly imagine pair programming as productive, or tolerable if it was being done in person.
Whereas doing it using screen sharing tools from the comfort of my home (or private office but who's had one of those recently?) - well I've actually done this, and it worked great. No body hygiene or smell issues to get with, no one snacking or drinking near you, no crowding or extra CO2 and sweat - just a nice tight feedback loop which people can dip in and out of without disruption, join and stop easily etc.
The idea of pair programming with other people physically in the room with you...I can't think of anything more unpleasant.
Pairing brings a new perspective to the problem and, for me, the social element is also valuable in that you also build relationships by pairing.
Though it's completely possible what you and I think when we say "pairing" might be different. For example, the ability to not check Twitter feed would only be an issue if you are pairing for hours at stretch. While my pairing sessions are rarely longer than an hour.
It's fine occasionally for training, as you suggest, or for explaining a design to people, but like you I feel it's an encroachment.
Thankfully I'm experienced enough that I can afford to refuse to take jobs that impose it.
1. That all developers can do/produce the same results.
2. That some people become dependent on others to write code.
#1 fuels the management misconception that hiring or moving devs will result in more work getting done.
#2 makes some individuals short change the PR review process. (I.E I was there when it was written, or I trust that pair thought through all the steps.
I think it’s great in a lot of situations, where something new is being started or for KTing, but as a daily practice it reminds me of those old school group projects where 1 person does all the work and the other gets the credit.
I especially like pairing with less senior devs that actually ask every question they think of. When I hear it, I try to pause and think what's this actually about and give as deep an answer as I can. Often this leads to discoveries that can simplify understanding, design and/or implementation. You get out of it what you put into it.
I’m currently doing pairing sessions with two junior engineers and it’s been great for everyone.
I’m also pairing for 2 hrs/wk with the other senior engineer on the team to explore an ambitious new project, and it feels like we just constantly grate on each other with slightly different designs in our heads.
I will say, though, that the conflict our pairing generates is valuable as it often illuminates decision points that would be good to escalate to the larger working group.
I'm happy to work this way when I'm doing UI/UX or end-user touching work; so much of that boils down to 'predicting the ways in which the chaos apes will behave' that having another perspective is useful.
When I'm doing database design, don't talk to me unless I ask you to: All it does is make me want to choke you and take me out of the flow.
Are you against co-pilots in aircraft for the same reason?
That can happen to a programmer just as much as a pilot, and it can be even more destructive. You could argue software generally isn't life and death, but who knows? You might end up working on something like curl or sqlite which may well have played part in the implementation of emergency services in some country.
Very curious to hear if you've thought about ego being apart of your position: if two minds can work through a design or implementation faster, but at the cost "I didn't get to figure this out myself" then you are prioritizing some personal puzzle solving pride over overall project efficacy.
Maybe this doesn't matter working for"the man" but, if you started your own business and it's empirical that working with others helps solve problems faster, would you have a different position?
Esteem and self-actualization are a part of maslows hierarchy of needs, I don't think this case is as simple as "pride".
> Pair programming is a skill which must be learned.
> You will not be good at it at first, but consistent practice will yield improvements.
> Don’t give up after a difficult first experience. Don’t assume experienced developers are automatically good pairing partners. Don’t expect to be good without practice.
> Consider reflecting with your pair or asking for feedback after each session. What could have been better?
In my experience (pairing on and off for about 12 years) - this is the biggest thing people misunderstand about pairing. You're not going to be good at it right away, and the team isn't going to benefit right away. It's an investment that pays off in months not days.
That being said - I find that requiring my team to be good at pairing, but not that they pair all day every day, is sufficient. It means that they pair when it's appropriate (onboarding, larger design problems, early stages of a project, etc) and they don't when it's less appropriate (fleshing out an implementation, exploring a new idea, mundane updates).
We find that if we pair all the time, especially on things that don't benefit from pairing, it exhausts us. Pairing is a useful tool, but it can be equally dangerous if overused and cause people to resent it.
For example, with one co-worker at the keyboard, I would fully take on a support role: He was a slow typist, so I'd keep an eye out for typos and quietly nudge him instead of having to wait for a compile/run loop, I'd look up documentation so he wouldn't have to keep context switching, and so on. Before that point though we had roughly equal roles at the design stage (he was a very strong proponent of "keep it simple" and made me realize I was drifting into an "architecture astronaut" mindset, so I think we worked really well together overall).
In another, with some co-workers unfamiliar with a codebase but wanting to learn more, I'd take the high-level guidance role where I'd be mentally working a few steps ahead on the overall design/goal while they worked on the nitty-gritty details. They'd be learning how the pieces fit together without having to worry yet about side-effects or other problems because I'd be acting as guardrails, keeping them on the right track and identifying those problems ahead of time so we can deal unavoidable ones right away. Ideally this role doesn't last long with anyone as they'll need to learn those parts on their own, but it works sometimes.
As a step up from that second one is on/off pairing, where they'd be testing their knowledge on their own to come up with a solution, then we'd pair for a while to make sure they're on the right path and maybe get past a spot where they were stuck on how to do something.
No. Use two monitors that are mirrored or with screen sharing, so that each person can sit comfortably centred on their own screen.
+ each person can have their own font/resolution
+ it doesn't dominate the entire screen, allowing each person to keep their own notes/etc on the side
+ at any point someone can "jump in" and take control of the session
+ interacting in a confined shared space radically reduces "over communication" issues. i.e. if you want to show something it's got to be demonstrable in a small textual window
+ you have a shared command-line, which is more useful than it might initially seem
+ seamlessly scales to in-person and remote pair programming
There are some downsides:
- it requires both users are familiar with a terminal based editor
- it may present security issues for folks operating in locked-down/low-resource environments (e.g. can't spin up a temporary machine with a shared account)
- sharing graphical information requires a separate communication layer
So we end sharing the screen over hang outs, that is basically very inefficient and wastes a lot of CPU. But because it is normalized, it is "the standard".
EDIT: my comment was a bit unfair. I guess I could install VS Code, change my daily editor, and use it with the Live Share plugin with those using VS Code. So hang outs it is.
Each workstation has a computer, 2 monitors, 2 mice and keyboards. When someone can't be at the office then we sometimes use Tuple, and it's a great tool, unfortunately still only works on Macs.
Pairing works for us because it's more efficient than working alone, less bugs and better thought out design, faster spread of knowledge about our tools and the project in general. I joined a year ago and hadn't used Java or IDEA, pairing helped me learn all of it very fast, compared to if I had to work alone and struggle with learning all of the new things.
I researched pair programming companies a while back and didn’t find any.
Anyway, the sibling article says:
"A pair of programmers tends to produce better code than someone working alone."
Let's assume this is true (I'm reasonably sure it's false). If one programmer can type code that's at quality N, then add a second one to look at what they're typing and perhaps you can say that quality will be >N since the second person might spot errors made by the first. But we just used TWICE as many people to write that "better" code. I expect there are industries where this burning of resources makes sense, but most of the time it won't regardless of the improved code quality achieved. We could write 2x the amount of crappy code and most organizations would opt to do that.
If we're pairing up at the terminal to teach/train/transfer knowledge, that makes much sense and has been done since the ASR-33. Also sometimes it helps to have two or more people stare at a debugging session together to crack a gnarly problem. Designing at the whiteboard has been a thing since Von Neumann and Turing (chalk board...)
Programming however, isn't a thing you do in pairs, imho. It's creepy and weird.
Sometimes it did allow for the equivalent of a pair programmer taking over the keyboard rather than explaining how to solve a problem.
I’m curious if anyone has any Live Share patterns / anti-patterns.
One of the more successful patterns that came out was to: talk about the goal, write out the code that acted as interfaces between the two of us, and then split up and tackle two things at once. That might have been code vs tests, backend vs frontend, migration vs adapting existing code. We would often then swap and discuss what we'd done (and we might be asking little questions as we go to help refine each other's approach), add improvements or plug gaps and then finally give it a good end-to-end run through with some exploration.
We were working together on the problem, asynchronously, and you'd be surprised how little there were occasions where a big assumption at the beginning was missed and made us go off in different directions. This was nearly always caught early as we talked whilst we worked on our separate areas and had a quick glance at what the other person was writing. I'm convinced that we caught them faster than if I was alone as we had the opportunity to think about the problem from multiple perspectives at once.
I recommend to instead let your pair in through SSH (a reverse proxy, like ngrok, is useful), and then sharing a tmux session.
I’m curious to hear what you dislike about pair-programming.
Speaking for myself, when I'm working on something complex and detail-sensitive, the very last thing I want to do is spend any time at all with anyone else. I want to be able to think properly about the problem without the pressure of having someone else involved.
You had better hope that the oft-touted knowledge transfer benefits of pairing are real, because you are going to have to deal with the turnover.
I won't say I totally disagree, but what are your reasons for thinking this?
There was some research in the early 90’s over multiple implementations as a way to avoid bugs. I still feel like it was dismissed prematurely or could be revisited.
Pair programing is something from the early 2000s, where code review tools were non-existent (I remember, people would just email diffs to each other), back in the day.
That said, it's not an intrinsic problem with code review, but a team culture problem.
I think pair programming has its uses, but unless the 2 working together are on the same level it's really hard to get into "flow".
I'm a big believer in correcting errant behavior in the moment. Simply the presence of an overseer can coerce a developer to avoid taking shortcuts with the hope that it might go overlooked in an asynchronous code review.
I am on a team of two, and yet, I rarely have time to audit code that my fellow has written, simply because the rest of the day demands other tasks to be focused upon
Then I believe something is wrong in culture of the organisation. It should definitely not be enforced but encouraged.
The reasons I believe that is because the human psychology is also based around success and praise from our relations.
The benefits you get from sharing thoughts and possible options to a challenge can hardly, imo, be bad.
Pair programming has taken place in my career, in cultures that encourages a pace to get work done, in a manner where quality is measured by how well a team works together and how well the team is capable of understanding eachother - but as a team.
I also believe that if you cannot explain in words, how you would go about solving a challenge, then it's premature to start coding on it. Then you are moving to fast.
Pair programming is like any other thing. It should be applied when necessary and not be enforced on 80% of the work because it's perhaps only valid for the hard 20%.
I have really thought about making a pair programming service for years, where people can connect and program as a pair, for the hard parts.
Good discussion
Writing mundane code in pairs sounds like a brute force solution that should be solved by training, higher quality code scanners or other code quality tools.
The greatest pattern is explaining your goals and seeing if other people's goals align with yours.
The chances of that conversation resulting in 'pair programming', is 0%.
We do full-time pair programming in my teams, and this guide is part of our “starter pack” for documentation.
As an aside, one of the things I make sure to do with new hires is to cover "beginner's mind". Just because you've got ten years on the iron doesn't mean you can't learn something new, and that something new might just be from the grass-green new guy that joined last week.
Likewise, for the new guys that think they're hot shit because they've got a degree from McSmartypants University doesn't mean you actually know anything. Don't just take things on an "I said so" basis, but also don't discount the value of experience.
When you run into a new idea: use active listening to ensure you understand it, and explore its ramifications. Poke and see where it falls down, and where it doesn't. You'll avoid a lot of bullshit this way.
- If you're the driver (handles the typing), don't allow yourself to be stressed and just type things someone else tells you to type.
- Language is really bad at comunicating where to make a change on a gigantic screen of text, expect yourself and others to become a bit frustrated at times, but it's at the difficulty of communicating things, not that the other person is dumb. "And change the type to bool. No not that one. Go to the end of the line, then back to the last bracket. No, the line you were at. Yes. Now go to the last bracket. Change to bool." And then take a second to understand why, asking if necessary, becuase it might get more difficult to understand later.
- It's extremely difficult not to get lost when someone else is navigating between tabs, especially if you don't know the code well (and sometimes even if you do).
https://keeptalkinggame.com/ (ideally play this with the defusal in VR)
KTANE even has (to a greater extent, and for humour) the ambiguities that can trouble talking to somebody about programming, like offering "YES", "AND", "&" and "NO" as options somebody needs to pick quickly.
Pair programming is terrible by default. You have to work to make it good, but then it can be great.
More details, in the form of a long form article, here: https://www.newyorker.com/magazine/2018/12/10/the-friendship...
Early Google's success came from substantial pair programming by Jeff Dean and Sanjay Ghemawat.
Some say Google wouldn't have been successful without this pair working together how they did.
https://www.newyorker.com/magazine/2018/12/10/the-friendship...
It's the same thing with two 'exterior' keyboards and mice.
FTFY
These days it's all fully remote. And that's worked out incredibly well since my team has gotten more and more geographically dispersed. The few that were before are now always in the loop.
I haven't done it full time in a while because my responsibilities other than implementation take too much time.
I'm old in my team and when I can, it works well for me. I share my experience, keep software focused, etc. The younger, high performers teach me new tools and tech. The fresh folks learn more how to think and do work from us. Stuff like that it's not just about making something work, but making something maintainable. I probably teach as much backspacing through a "clever" idea I had, than by writing anything. That and how to break a problem into chunks. Then reevaluate that and make it clean.
Pairing is also great for the more ops side of things. I think in a lot of ways you get even more bang out of it there than programming. Have 1 person do the work and a newer person improve the docs as they go. Then flip for the next iteration, with the new person driving and the experienced one helping and tweaking docs. Call out places where automation could replace procedure and get them in the backlog to be prioritized later. The same pair can pick up those stories when they come back around.
I have experienced some of the pains of this list. I worked with a guy who I joked "painted" code. Lines just growing and shrinking like a horizontal EQ. It was dizzying and unpleasant. I often just checked out and pointed out missing braces every once in a while.
Same guy brings up an issue not mentioned here for physical pairing: make sure you bathe. Ugh.
Also, make sure you're rotating teammates. Sticking in 1 pair can be nice if you like the person... for a while. But it can ruin a friendship if you do that for months.
I think the real keys to success there are in luck and management's hands. Make sure you have a mix of maturity and skill sets, and have engaged curious people. Slackers and, uh, "dim" people drag everyone's morale down more in an environment like that. I've lost those teammates and seen team productivity grow. At the same time, it's hard for a team full of people with little to learn from each other to stick with it. It's more engaging when you're teaching or learning or ideally both.