How to Practice Pair Programming for Great Results
A guide to making Pair Programming successful.
Join the DZone community and get the full member experience.Join For Free
Pair Programming (PP) is an extreme programming approach to produce better software where two people work together at one computer and work is reviewed as it is done. The driver operates the keyboard while navigator is watching, asking questions, guiding, reviewing, learning and making suggestions. Find more about PP at Wikipedia.
We often hear that Pair Programming is a “waste of time”, “doesn’t really work”, “suppresses creativity”, “kills privacy”, “stressful”, etc., These are all genuine concerns any team may have based on their circumstances and experience.
Some of the Problems We Generally Hear About Pair Programming Are:
- Pair-Jelling: The initial period may take more time when the programmers are adjusting to working together.
- Scheduling: Programmers find it difficult to find a common time to meet and perform because of their time preferences.
- Partner Compatibility: Most commonly observed because of partner personality clash, habits, different skill level, experience level, programming style, self-esteem, etc.,
- Personal Space: Some developers feel they are losing their personal space and also can’t concentrate well.
- Adaptation: When the team does not buy the concept of pair-programming, it seems like a waste of time.
- Co-location: Pair programming requires a lot of communication and expression to code, review, debug and test the work. When teams are distributed and working remotely and there are no right tools to collaborate, it becomes difficult to progress the work.
- Role-Preference: Some prefer being a navigator all the time and just want to provide the guidance to the driver and it may frustrate the driver to play that role always.
- Pair-Pressure: When one of the partners is rushing to complete the task and do a poor job, it results in errors and low quality, which leads to dissatisfaction.
Pair programming is a specialized process and it needs understanding, training, and experience to benefit from it.
Things to Consider for Successful Results With Pair Programming:
- Management needs to realize the benefits of the Pair programming practice to implement it in the organization. There will be a learning and adaptation phases for the teams and Managers need to support the teams during these phases.
- Pair programming doesn’t have to be for an entire team — the team can decide the right percentage of the practice in a sprint or a day.
- Conduct training sessions on the Pair Programming concepts and the ways to benefit from this practice.
- The schedule of the team members play a good role in implementing this so, find a common time for this activity. Acquire the right communication tools for collaboration when the team is distributed. One advantage of the distributed team is that the schedule may become easy.
- What type of work is qualified for Pair programming?
- What are the best times in the day for activity?
- Mock/Experiment sessions of Pair programming helps the team to understand the approach and can clarify their doubts for readiness.
- As there will be a lot of conversation between the pair of members, the team needs to be prepared for a certain level of noise. Alternatively, a specific desk/room can be allocated for the pair programming activity to reduce the noise levels.
- Both partners should take ownership to finish the work.
- Understand that there will be a slight increase in the development costs (20%+) in this approach but there are long term benefits with it.
- Take feedback from the pairs to improve/change the process for better results.
- Define the ground rules on how to do pair programming. Some of the aspects to be included in the rules:
What activities are allowed?
What activities are not allowed?
What are the expectations of the pair?
How long a session can go?
How to define the goal for the session?
How to find a partner?
Avoid Pair Programming When:
- Tasks are simple and straight forward
- There are no right tools to collaborate remotely
- There is no right companion for a time-bound critical task
- A partner feels a lot of stress in the activity
- The team doesn’t know the concept of Pair programming
- Pair does not take ownership of the outcome
Following Benefits Can Be Observed With Pair Programming:
Increased Productivity: Team achieves more in the given time, as they are working with collective knowledge, more focus, varied experience on the project/domain.
Reduced Defects: Continuous review of the work, debugging and testing the code together produce fewer errors.
Improved Quality: Enforcing the coding standards and best practices during the Pair programming process helps the team to avoid rework. Pair could discuss/debate and implement the best design patterns, data structures, and optimal logic to produce a high-quality product.
Reduced time: When there is a critical need to finish the work quickly like troubleshooting a production issue or analyzing a tricky scenario, PP helped to solve the puzzles in an easy way.
Learning for better: During Pair Programming, when a member uses some tricks and techniques to achieve the goal, that helps the other person to learn those concepts and use them in the future.
Training/On-boarding: PP helps in transitioning the knowledge and works great when you have new members on the team. Navigator plays a contributor role while the driver is the receiver. This approach indirectly reduces the training cost of the new members.
Knowledge sharing: Team members with heavy knowledge of the project tend to have more dependency, as they are knowledge-towers. It is always a good idea to spread that knowledge to others to reduce the dependency of those people. When these heavy-lifters pair with others, it helps to spread the knowledge easily.
Team bonding: Pair programming done positively works like a team-building activity as well and creates team bonding.
Better communication: PP encourages breaking the silence and communicates more about code, project, company, client, workflow and anything required. This helps the team to improve their communication skills and soft skills.
Increased confidence: Increased quality and productivity has a positive effect on the team members - Their confidence levels have increased multi-fold.
Increased satisfaction: Complex issues are solved in a systematic way by the right pair of people and it gives them great satisfaction.
In my personal experience, we achieved great results by practicing Pair Programming.
Have you tried Pair Programming? Was it successful? Comment and let us know!
Opinions expressed by DZone contributors are their own.