This week marks the first anniversary of starting to do daily pair programming with another Samba developer, Andrew Bartlett. It has been an absolutely fantastic experience, and I thought this would be a good time to write up what we’ve been doing.
For many years I’ve been doing ad-hoc pair programming with various people. I have used a variety of techniques, from combining IRC with a shared GNU screen session, VNC sessions, NX sessions and lots of other combinations. What is different about the last year is that it wasn’t just a bit here and a bit there – we started working together on a daily basis.
We started off using long phone calls combined with a VNC session to share one of our screens. I originally used x11vnc to share my desktop, but we’ve more recently moved to using x0vncserver, part of the TigerVNC package. We’ve also moved from SIP phone calls to using a mumble server, which has allowed us to open up our coding sessions to other Samba developers, which has been very helpful.
daily coding sessions
The pattern we’ve got into now is that we both login to mumble around breakfast time. Like Andrew I tend to eat breakfast in front of my computer, while having a quick look at sites like lwn and slashdot. Andrew usually joins mumble around the same time, and we chat about what we are going to work on that day. After we’ve both finished our cereal we dive into coding.
The most common pattern is that Andrew connects to my desktop over VNC, which I have shared over a VPN. I have a script which runs this command in a terminal:
x0vncserver QueryConnect=1 QueryConnectTimeout=30 AlwaysShared=1 PollingCycle=300 ZlibLevel=9 SecurityTypes=None \
AcceptKeyEvents=off AcceptPointerEvents=off PasswordFile=$HOME/private/VNC/team.pass
that shares my current desktop read-only, and prompts me when someone connects. It also sets up a slow polling cycle, which means the VNC session doesn’t chew too much bandwidth, which means our mumble VOIP session doesn’t degrade. It allows for multiple people to connect, which is really useful when Zahari or Kamen join in from Bulgaria, or Jelmer joins from the Netherlands.
audio setup
Andrew uses a fancy wireless headset which he can switch between being a pulseaudio device for mumble, and being a phone handset for when people ring him. The headset means he can walk around his house while we’re coding, which really suits him, as he often needs to help Kirsty out by hanging nappies on the line or doing a bit of cooking, and we can keep talking about the latest kerberos issue while he’s doing that.
I use a cheap desktop microphone (a Logitech one) along with desktop speakers. That means I don’t need to wear a headset all day, which is much more comfortable. If you adjust the mumble audio settings carefully you can avoid echo and avoid having the noise of typing come through, while still having really clear audio with a desktop microphone. I put the microphone on a rubber mouse mat to isolate it a bit from the desk.
writing code
With the above setup I just use my usual coding environment, which is emacs plus a bunch of GNU screen sessions in a gnome-terminal. Andrew watches me code and test, while we discuss the approach to each problem as it comes up, and he suggests different approaches. When we are working on a piece of code where Andrew is the expert (eg. all the auth code, kerberos etc), we often switch around so I’m connecting to his VNC server instead and I comment on his code while he is writing it. I use a command like this to connect:
xtightvncviewer -passwd $HOME/private/VNC/abartlet.pass -viewonly -quality 3 -compresslevel 9 server
That gives me a pretty good view, while minimising bandwidth usage. When we need to share files, we either rsync it somewhere, or we push it to a personal branch on a git repository.
the results
The results over the last year have been really amazing. Between the two of us Andrew and I have pushed over 2500 patches to the Samba master repository over a year of pair programming, which is more than twice what we managed in the previous year. I find it really interesting that despite only one of us typing at a time, we get much more done with pair programming than when we work separately. The results are even more notable when you take into account that in the last year Andrew has been rebuilding his house and looking after a new baby!
I think the reason it works so well is that it tends to minimise procrastination. When I code alone and I’m stuck on a bit of code, I often find myself drifting off to read slashdot or muck about with some new application that I’ve found. That happens a lot less when someone else is watching over your shoulder on VNC. We discuss how we’re going to solve the problem and then we solve it, without the hours of procrastination in between.
The code also ends up as much higher quality, with a lot less bugs. Andrew is great at spotting subtle issues in my code while I’m typing it in, which saves a lot of debugging time.
It’s also interesting that we’ve found that pair programming works a lot better when we aren’t in the same room. We both live in Canberra, which means we could drive over and code right next to each other, but we find we just don’t get nearly as much done that way.
some highlights from the year
Pair programming is also just a lot more fun than programming alone. After having been a lone coder for 20 years, moving to pair programming was a revelation. By being on mumble all day, I get a lot more social interaction with other developers. I think it’s fair to say that most of my social interaction is now over the mumble VOIP link.
One really fun time was during the SNIA CIFS conference in Santa Clara in September and the AD plugfest the following week in Redmond. Andrew couldn’t travel as Celeste had just been born, so I took my desktop microphone with me and used it to allow Andrew to attend the plugfests remotely. That worked extremely well! We setup some speakers attached to my laptop, and again shared my screen with VNC. Andrew was able to participate fully in the plugfests, even if it meant he didn’t get any of the free food. His knowledge of authentication protocols was essential to many of the problems we faced during those two weeks.
There have also been lots of fun moments when Celeste has decided to chime into the conversations as only a 2 month old baby can, with Andrew often holding her on his lap while we are coding. At my end of the link I have a similar effect when my little dog Nessie (a king charles cavalier) comes into my study to ask for a biscuit by whining pathetically. She nearly always gets the biscuit.
Another amusing incident was when I got a letter from my SIP provider saying threatening to cut me off as I was costing them too much with these 8 hour untimed phone calls every day. That was before we discovered mumble, so I just switched to a different SIP provider.
The switch to mumble, which made it easy for us to have several people connected at once, was also a big advance. It allowed Andrew and I to help a number of new Samba developers to find their feet with some very tricky code by working with them directly than we could do over IRC. We’ve spent many hours working with Nadya, Kamen, Anatoliy, Zahari, Kai and many others on some very tricky code, and it has helped them to become better Samba developers. It works well despite them being spread out all over the world.
give it a go!
If you haven’t tried pair programming then you really should give it a try. Find someone else working on the same project as yourself and see if your coding styles are compatible enough for shared screen coding sessions to work. I’m sure it won’t work for everyone, but when it does work its a fantastic way of making yourself both more productive while having a lot of fun.
Thanks partner!
Finally I’d like to say a huge thank you to Andrew for being such a great coding partner for the last year. Your patience when I’m coding something badly has been fantastic, and you’re support when a test just refuses to pass has been brilliant. Thank you!