Remote Pair Programming
Pair programming is a fantastic way of sharing ideas, training, being productive and writing high quality code. Remote pair programming can be just as effective. I love pairing on projects. If you have an interesting open source project you’re working on, and want to pair on it, hit me up.
Different types of pair programming
There are a couple of common approaches to pair programming that I see a lot. Approaches and the specific details can be heavily dependent on the people involved, their preferred way of thinking and learning, and their level of expertise.
They can be split into categories, either by looking at the interpersonal management of the work, or by the technical differences in editing source code.
Firstly, we can look at different methods of managing the workload:
- Unstructured. Simply, two people collaborating on solving a problem, without any particular set of rules about how this should be done.
- One person is driving the direction of the development “i.e. “We need to write a test that checks for this”, the other is at the keyboard, implementing those directions, i.e. writing the test. This can be broken down further according to how prescriptive the leader is. Do they get right into the details, or are they taking a 10,000 ft approach to direction?
- One person is leading the task and at the keyboard. They are describing what they are doing. The other person could be learning or mentoring. They could also be taking notes and, from a slightly detached viewpoint, spotting mistakes or thinking strategically.
- One person writes the next test. The partner then takes control and writes the code that gets the test to pass. They then write the next test, and pass back to the first person to write the code and repeat the loop.
These approaches are orthogonal to whether you are working remotely or in an office together.
We can also look at the technical details two people writing one thing.
- Two people sit in front of the same computer together. The keyboard swaps between them. As they swap, the same files are open in the same editor. So, they must both use a shared editor and set of keybindings.
- Two people sit beside each other on their own computers. When they swap they can use their own preferred editor, key bindings, etc. This is generally more ergonomically pleasant. The pair will need to synchronise the source files they have been working on when they swap roles.
These technical approaches can also be largely orthogonal to whether you are pairing remotely. There are some useful tools to screen share, edit files simultaneously, or sync code seamlessly.
Many general purpose chat & conference tools have screen-sharing facilities that are perfectly sufficient. As long as you can communicate effectively and the screen lag is not terrible, you’ll be fine. For example, Slack or Zoom, along with a lot of git commits and git pulls works fine.
This technique works fine for me, but some people like a much finer grain of
swapping who is in control than 1 red-green-refactor, or 1 ‘commits-worth’ of
work. If you like to swap who’s controlling the keyboard in the middle of a
sentence, you’ll love mob. This
allows a group of collaborators to work together on a shared codebase quickly
and with minimal friction. Each collaborator calls mob start
to start sharing
code on a WIP branch. One person works on the code. To hand over, run mob
next
. Once you’re happy you’ve got a ‘commits-worth’ of code, mob commit
squashes the WIP commits into a single commit and commits onto the current
branch. Then you can do a regular git push
to ensure your remote repo is
current. Eventually, you’ll want mob done
to end your collaboration session.
Pop is another good looking tool that allows screen sharing, collaborative drawing and mouse & keyboard control. If you like working on a closely shared environment (where you have the same editor and keyboard shortcuts, etc), this works well. If you like the more individual approach, you can also use this tool as a good screen sharing chat tool with some nice extra features.
Tuple is a great screen sharing tool for macOS users (a linux version is in beta). In addition to the ‘standard features, it has nice additions for helping to diagnose screen share performance to ensure your screen share quality stays sharp, and integration with OS features (like link sharing and enabling ‘Do Not Disturb’) that remove friction from a pairing session.
Pair programming and remote pairing are such a fantastic way to work. The great thing is that there is no One True Way to do it. Find one that works for you and your pairing partner.