Ping-Pong Pair Programming (3P)

Hüdai Semih Çavdar
3 min readJan 29, 2021

--

In this article, we are going to talk about Ping-Pong Pair programming. My team has experienced and continues to follow this practice and I would be glad to share our experiences here with you. Hope you enjoy it!

What Is Ping Pong Pair Programming?

In fact, Ping Pong Pair programming is a combination of Pair programming and Test Driven Development. But how?

As you know Test Driven Development has 3 cycles. Let’s remember this cycles simply:

Red : Write a test that will fail. (This should take less than a few minutes. Because you are not testing the whole)

Green : Write a code to make it successful (If there are broken tests, fix them too.)

Refactor: If needed refactor the code.

We made a small introduction to Test Driven Development before. If you haven’t read it, you can access it from the link below.

In Ping Pong Pair programming, 2 developers are working on 1 task. In this example let’s name them developer A and developer B. Let’s start to ping pong pair.

  • Developer A writes a test that will fail. So the developer A completes the first cycle of Test Driven Development (Red).
  • Then Developer B writes a code to make this test successful. In this way, developer B completes the second cycle of Test Driven Development (Green).
  • If there is no need to refactor, then developer B writes a test that will fail.
  • Then developer A writes a code to make that test successful.
  • If refactor needed, the test writer makes the refactor after that test passed.
  • Continue until Developer A and Developer B both agree that there are no more tests for the task they are currently working on.

Benefits Of Ping Pong Pair Programming

  • It ensures that the task is understood correctly. If not then the conversation begins. We usually use this method to pair experienced and relatively new colleagues to spread business and domain information.
  • Keeps developers more active. Less monotonous because the order always changes.
  • As it contains Test Driven Development, provides the same benefits that Test Driven Development includes.

Handicaps Of Ping Pong Pair Programming

  • If you work remotely, you need to have a good internet connection with some screen share tools.

Resources

The links I have used are below :

--

--