Few days ago I worked few hours on Sunday, so there were only me and one of my co-workers in the room. He is Delphi guy, but likes to learn .NET. He had to implement some custom resizing logic for the report and he asked me if I can help to think on the logic. We had spent maybe couple of minutes before we got some preliminary ideas.

Let’s do Pair Programming

We decided to implement some prototype/logic within .net. I suggested pair programming with TDD: “I will be writing tests – you will be implementing logic to make them work”. BTW, do you know how do we call this particular programming pattern? – It is called “Ping-Pong Pair Programming“.

So after I created basic test project and wrote a test that simply has something like “var report = new Report();” and then “report.Draw();“, which of course is failing UT, he proceeded with creating class for Report and putting in place stub method Draw. Then I added functionality that allows adding report columns, then sizing of them, desiredMinimalWidth and delimiting width. Then UT that verifies if we correctly resize columns, if they fit or do not fit into report. Misha was performing extremely well in implementing logic, we had been thinking on. At some point of time he got stuck, so we continued together on making latest UT work.

I enjoyed this try of doing Pair Programming along with TDD.

What are benefits of doing PP as per me?

  • Knowledge sharing
  • Less bugs
  • Quicker problem resolving when working on complex tasks
  • More control on what other in pair is doing (in other words you will be sure that he is not using his time to watch YouTube)
  • Building great team spirit

Are there disadvantages?

It might happen that PP will not be feasible, especially in situations when problem they are trying to solve is trivial or when one of contributors is not interested in going great job. You can read lot of discussion over the internet about the time PP consumes and the quality of the work. Most commonly you will hear that when doing PP it takes +15% of time if two developers work independently and produces 15% fever bugs.

What are preconditions on doing Pair Programming as per me?

  • Problem you going to solve are complex and require writing new code
  • Good to have two competent developers, but one of developers is a must
  • One of the developers is really dedicated to work
  • A great plus would be if your system allows you to write Unit Tests
  • You bet on quality, not on quantity (sometimes better decision for the business might be to deliver quick and lot)

In my further professional growth I will try to involve more people in this practice!