Ping-Pong Pairing Over Git

pingpong

When practicing new programming techniques I am a fan of ping-pong pairing. Ping-pong pairing is a way of pairing with TDD that evenly distributes the amount each programmer spends in front of the keyboard and the amount of test code versus actual code each programmer writes.

The description from the C2 Wiki reads:

Two programmers sit in from of one computer, with one keyboard and one screen.

Ping-pong pairing is great in a learning context because it keeps both programmers in front of the keyboard and it encourages conversation.

But, there are a couple of problems. Keyboards and editors! What if one programmer uses Dvorak and the other Qwerty? Or, one programmer cannot even think of writing another line of code without Das Keyboard while the other prefers an ergonomic keyboard? Or, one programmer uses Vim on OSX and the other Notepad on Windows?

Ping-Pong Pairing Over Git

What if we alter the setup to give each user their own computer, keyboard, screen, rubber duck, or whatever tickles their fancy? It would seem that this isn't paring any more! But, if we place the pair side-by-side and let them communicate over Git, we actually get a very nice flow. There is still only one person typing on the keyboard at a time, but they are typing on their own keyboard.

The pattern above is changed to:

I've tried this pattern on a couple of code retreats and it is actually pretty smooth. To make it even more smooth I implemented a simple command line utility, tapir that allows for simple communication between the two computers and automates the pulling of the new code. It works like this. Each programmer starts a listener on their machine that pulls the code when it receives a message.

Write a simple script to combine git push with a calling tapir mytopic

Now, instead of calling git push, you call ./push and the code is automatically pulled on the other machine, eliminating one step from the loop.

Summary

Ping-pong pairing over Git is nice! If you are interested in trying it out I have a roman numerals kata with setup code for multiple languages, currently: Clojure, ClojureScript, Javascript, Lua, VimScript, Objective-C, PHP, Ruby and C.

Tapir 3

The tapir command line utility is also pretty interesting as it uses ServerSentEvents to communicate over a standard http server, http://tapir-server.herokuapp.com/

Why is the utility called tapir? Because, pingpong and ping-pong were already taken and I like tapirs! :).

4 Comments

  1. It’s an excellent idea and I definitely want to try it!

    One of the good things about pairing is the amount of knowledge that is transferred just by watching the other programmer code. The shorctuts she’s using, the method names she tries, before settling on the right one, etc.

    I’m worried that some of that would be missed with this technique? How did it work in your sessions?

  2. @Andrzej, Since the pairs were sitting side-by-side even though they had their own computers, the sharing worked flawlessly. I didn’t notice any tendency of wandering thoughts. This would of probably be different if the pairs were not sitting side-by-side.

  3. This is exciting. But it would mean that code in the repository could be broken. Or just use another branch while ping-ponging?

Leave a Reply