Image source: Wikipedia
What is pair programming?
In pair programming, two programmers work together on one computer or system to achieve a defined goal or objective by applying their ideas through collaborating and communicating with each other. The programmer writing the code is called the Driver
, and the programmer who reviews the code and suggests changes in the development is the Navigator
. Driver and Navigator swap roles after defined intervals.
Members on some teams believe that they are following pair programming when two programmers sit together for one or few hours a day. After that period of pairing, both programmers develop code separately on their own systems. Working on different teams, in my experience, is not really pair programming. Pairing within a team is generally visible even to those who are not working with a particular team. Pair programming can be observed when a few pairs are sitting and working together for almost the whole day. They repeat this process until they are finished developing the module they are working on. Pairs are usually sharing the same computer while working on the delivery; in that sense, pairing is visible to outsiders.
Pairs can finish development by following these guidelines:
- Know that communication is more important than technology and tools.
- Take turns; swap the Driver and Navigator responsibilities.
- The Navigator reviews the written code and provides suggestions.
- Understand the indicative and interrogative moods.
- Yours / Mine
- Yours / Mine?
- Navigator has active responsibility for driving the code.
- Implement ping-pong programming by using test-driven development.
Achieving pair programming in today’s global environment is a bit tricky. The team has to be more creative to make sure that international team members don’t feel isolated. To achieve pair programming in a global environment, consider the following:
- Three constraints exist: network connection, shared coding environment, and peer communication.
Solution: Multi-user editors, screen sharing, and SSH Terminal access.
- Use of technology.
- Use VoIP over traditional phone.
- Use headsets.
- Hold video conferences using Skype.
- Use Google Docs for document sharing in a live environment.
- Include remote counterparts in local conversations.
- Do not turn on mute or turn off video while communicating to other team members.
Pair programming indicators
- The team’s mindset changes about pair programming.
- The need for SMEs within the team is diminished.
- Consistent reports are generated because of equal team contribution.
- High-quality product development is achieved at more or less the same cost.
- The team is more self-organized.
- A decrease in the number of bugs and defects is reported.
- The team’s skill set is fully developed.
- The team is more interested in achieving a common goal by sharing ideas.
Many teams believe that pair programming is expensive to follow because the cost of development increases when two programmers develop the same module together. Based on my experience, I agree that the cost of direct
development increases, but do not forget that the indirect outcomes achieved through pair programming are far reaching in comparison to the increased development expenses, for the following reasons:
- Code has fewer typos.
- Two programmers have different perspectives and approaches to developing code; two minds consider varied use cases instead of one mind considering only one use case.
- Code quality is improved, as both programmers have varied experience and backgrounds.
- Fewer defects are reported due to improved development.
- Time is used efficiently when resolving critical issues; there are two minds to work on one problem.
- The pair is more focused, and one member of the pair motivates the other.
- Communication is improved.
- The team is more cross-functional.
- There is an increase in self-organization within the team.
- Knowledge sharing occurs across teams; hence, the absence of one team member does not so critically impact development.
- More and varied expertise is developed within the team.
- Team members have better chemistry and deliver better quality.
- Productivity can decrease in the beginning.
- There is less autonomy, as most obstacles are resolved by discussion.
- Not everyone is as productive in a pair as they are on their own.
- Each pair needs to handle tremendous synchronization while working and taking breaks.
Every team can try pair programming, because it has remarkable advantages. Getting a successful outcome is completely dependent on the team's work setting, product, working style, and a few other factors. Hence, it’s a better idea to taste the cake than to wonder whether it’s tasty.