Practical Pair Programming

Practical Pair Programming

Jason Garber

You might also trade control by tying each turn to a cycle like that of test-driven development (TDD). Under TDD, you first write a test for the tiniest change in behavior, watch it fail, then write the minimum code that makes the test pass. You next take the opportunity to refactor the production code and the test code, and only then move on to the next small change in behavior. “Ping pong” pairing, as Ward Cunningham describes it, simply alternates who writes the test and who makes it pass. After perhaps many iterations, you will have satisfied all the acceptance criteria for the story and can consider the feature done (http://bkaprt.com/ppp/02-03/). By working in this fashion, you ensure that both of you not only have equal time driving, but you get to challenge each other to only make small changes to the codebase, have the test suite passing after every change, ensure high test coverage, and collaborate on refactoring at each step.
308