1. Pair Programming

What is pair programming?

Pair programming is the practice of two people, usually two coders, sitting together at a single computer to write code. Link to pair programming on wikipedia. Pair programming is usually used to hopefully improve code quality, or to transfer knowledge. Although the practice often provides benefits, it can also do harm. When individuals are adamantly opposed to pair programming but are forced to do so it may cause them to quit the company. Also, when developers are forced to pair program when pair programming is unnecessary it can be demoralizing for developers because most want to be doing something productive. I’ve seen several pair programming sessions where one developer spends an hour coding while the other spends the hour gaming or on social media sites.

Why adopt pair programming?

Teams usually adopt pair programming in order to improve the quality of their software. So, if code quality is poor and you have a lot of bugs getting into production, you may want to consider pair programming. But there are other reasons to pair program, or at least do so occasionally, and some of those reasons are:

  • to mentor others
  • to learn different ways of doing things in the code and tools for coding from each other
  • to brainstorm how to fix challenging problems.

Why not adopt pair programming?

When bugs are rare and each developer has enough knowledge about the business domain and coding language and software design to perform well, using pair programming can be a waste of time.

How does your context affect the success you will have with pair programming?

1. How does the Organizational Structure in your context impact the probability that Pair Programming will add value to your process?

Organizations that focus more on team output instead of individual output are naturally more supportive of pair programming. Conversely, organizations that reward employees at the individual level will have more resistance to pair programming. Staffing structures that rely on and reward specific areas of expertise may struggle to implement pair programming, as may organizations with matrix structures. Teams that remain together for a long period will have more success with pair programming, partially because it takes time for each participant in pairs to understand how best to work together with a specific partner. Both a company and a contractor are less likely to want contractors to pair unless the purpose of the pairing is to transfer skills to an employee. When staff members are reluctant to share their knowledge because they are concerned they will be less valuable to the company others know what they know, then pair programming may have less success.

*2. How does the Development Team Culture in your context impact the probability that Pair Programming will add value to your process?

When people enjoy their work they are more motivated to try new things and work with their team members to make improvements. But when people are unhappy, they are less likely to make changes imposed upon them, and less likely to be concerned about the quality of their output and their level of productivity. If there is little trust, fear of making mistakes, blaming problems on others, and a general lack of teamwork, most developers will be far less motivated to expose their daily development practices to the scrutiny of others. Pair programming risks exposing some vulnerability and that won’t work well when people don’t trust each other. But if the team accepts that it is acceptable to fail sometimes, and everyone always has more to learn, pair programming will be more likely to succeed.

3. How does the Hiring Process in your context impact the probability that Pair Programming will add value to your process?

Some people are very reluctant to work as a pair programmer and would rather change jobs than pair program. When you hire people, are you looking beyond the technical skills they may bring and considering how well they work with other members on the team? Perhaps your company lets the team the hiring candidate will be part of interview the candidate, and in turn, the candidate gets to meet the team they would work with so both sides can decide if they are a match.

*4. How does the Team Composition in your context impact the probability that Pair Programming will add value to your process?

Pair programming is a great way for senior developers to transfer knowledge to junior developers. Knowledge transfer is not just about coding skills, but also knowledge about the business domain, the patterns used by the team within the software, project management practices, and devops. Any person may have less knowledge than the person they pair with in specific areas. Pair programming is also beneficial when you have two junior developers that don’t have a senior developer to turn to. In this case, two minds trying to understand and solve problems may be better than one. Pair programming often has less value with both members are senior members with similar knowledge and skills. Unless the code is really complicated, the team as a whole will often deliver more value by allowing the senior developers to work independently.

*5. How does the Training Provided on Code in your context impact the probability that Pair Programming will add value to your process?

When the organization provides little training on the code and tools and a person is not experienced with them, pairing may be the optimal way to quickly improve the person’s skills. Even experienced coders often learn new IDE features and better ways to write code when pairing.

*6. How does the Training Provided on ‘Our Ways of Doing Things’ in your context impact the probability that Pair Programming will add value to your process?

When the organization provides little training on your ways of doing things, including your devops and project management practices, pairing may be the optimal way to quickly improve the person’s knowledge.

*7. How does the Environment in your context impact the probability that Pair Programming will add value to your process?

The environment might have the biggest impact on the ability for your team members to pair successfully. Fortunately, the aspects of the environment that hinder pairing are often relatively easy to fix. This can include provide a workstation configured to support two people with two keyboards, and possibly private rooms or quite areas where they can talk together.

8. How does the Project Selection in your context impact the probability that Pair Programming will add value to your process?

The way in which projects are selected probably has no impact on the success of pair programming, though some projects may provide better pairing opportunities than others, and some projects, those that demand higher quality, may benefit more from the practice.

*9. How does the Solution Purpose in your context impact the probability that Pair Programming will add value to your process?

Often, the goal of pair programming is to improve code quality, but the demand for quality is very low for some types of solutions such as prototypes, demo applications, or proof of concept and proof of technology projects. Sometimes projects are given to one person primarily to allow them to work on building their skills at their own pace. For these previously mentioned types of projects, pair programming is probably counter-productive. This is even true for many internally used applications when quality demands and the number of people using the software is not high. However, most software development teams spend more time focused on projects where quality is more important, and for those projects, pair programming often adds value. Teams that require pair programming for every project regardless of purpose, are probably wasting development time, and the developers usually know this and can be demoralized by it.

*10. How do the Application Architecture Priorities in your context impact the probability that Pair Programming will add value to your process?

When you goal is to deploy as many features as fast as you can and quality is not a major concern, then pair programming is a detriment to that goal. Alternatively, when your software demands the highest quality and insurance that there are no bugs nor the least bit of down time when a feature is deployed, then pair programming can be extremely valuable. People work in different contexts and often don’t think about other contexts. For example, you may be wondering when quality is not important, but there are many web sites, particularly those with static content, where minor functional errors can be quickly and easily corrected, or even ignored for a long time with little negative impact. Conversely there is software used that is literally keeping people alive by regulating medications and in other scenarios; and you can’t afford to make a single mistake without terrible consequences.

*11. How do the Security Demands in your context impact the probability that Pair Programming will add value to your process?

Security, code and coding practices that keep your software solution from getting hacked, could be included in the consideration for Application Architecture Priorities, but the war against hacking is so prominent that I separated it for consideration. When the demand for strong security are high, many organizations will have tools and quality assurance and auditing processes to assess the code for vulnerabilities, but many flaws may be overlooked by those tools, so two sets of eyes provided by pair programming, especially during the design of features that need to be secure, can be invaluable.

12. How do the Requirements, Features, and Priorities in your context impact the probability that Pair Programming will add value to your process?

When requirements and feature designs are vague, and the team isn’t able to easily and quickly get clarifications, it can be helpful to have two developers working together to help interpret what the software is expected to do.

13. How do the Regulations in your context impact the probability that Pair Programming will add value to your process?

When your software has rigorous rules related to some features, perhaps processing of credit card payments and monetary transactions, or high demands for security and data confidentially such as HIPAA, then pair programming may be beneficial to insuring your software meets those requirements.

14. How does Who Decides What To Do in your context impact the probability that Pair Programming will add value to your process?

People more readily adopt practices when they have input in decisions about doing so. In fact, the more involved a person is during decision making the more likely they are to try to help make the outcome a success. When developers are treated like coding engines that are just expected to do the tasks assigned to them, there can be less motivation and less willingness to work with others, including pair programming.

15. How does Project Management in your context impact the probability that Pair Programming will add value to your process?

Your first thought may be that Project Management has little impact on pair programming, but having witnessed the contrary several times I know that is not the case. Many project management task boards only allow a single person to be primarily responsible for a task; and many companies use the task board to monitor how productive a person is and sadly, even how much they are contributing. If a company uses the accumlated statistics from the task and kanban boards to evaluate the performance of people, then they need boards that accurately reflect pair programming contributions if pair programming is valued.

16. How do the Quality Processes in your context impact the probability that Pair Programming will add value to your process?

The processes you have in place to assess the quality of your software probably have little impact on your team’s ability to use pair programming. Of couse pair programming is itself, usually implemented as an attempt to improve the quality of the code that it written.

17. How does the Architecture Forecasting in your context impact the probability that Pair Programming will add value to your process?

The plans you have for evolving the architecture of your application probably have no impact on your team’s ability to use pair programming.

18. How do your DevOps in your context impact the probability that Pair Programming will add value to your process?

Currently DevOps don’t impact your ability to pair program, but it is worth noting that artificial intelligence, such as Github’s Copilot, may become the pair for each developer, replacing their human pairing partner. In addition, Static Code Analysis (SCA) tools, that scan your code as you work or immediately after you commit work may become good enough to replace a human pair. Please read the response below about how “Code” affects pair programming.
A slow DevOps pipeline may benefit greatly from pair programming. If your team is unable to quickly fix bugs in the deployed environment, then avoiding deploying bugs may become more important. This is particularly true if the cost/impact of bugs is high. On the other hand, if you can quickly fix deployed bugs, and the cost of those bugs is not high, then the cost of pair programming may not be worth the return in fewer delivered bugs.

19. How does the Architecture in your context impact the probability that Pair Programming will add value to your process?

The architecture of your application probably has no impact on your team’s ability to use pair programming.

20. How does the Code in your context impact the probability that Pair Programming will add value to your process?

Some programming languages support pair programming better than others because the tooling around the languages have features that better facilitate pair programming. For example, some IDE’s have easily integrated testing frameworks that facilitate pair programming practices in which one coder writes a test, then the next coder writes the code. And some IDE’s have the ability to share the same IDE workspace allowing people to pair even when they are remote.

21. How does the Code Quality in your context impact the probability that Pair Programming will add value to your process?

I don’t think the quality of the existing code impacts your ability to pair program, but code with poor quality can benefit greatly from pair programmers working to insure changes are correct.

22. How does the Application Quality in your context impact the probability that Pair Programming will add value to your process?

The current quality of your application probably has no impact on your team’s ability to use pair programming.

*23. How does the Deployment Environment in your context impact the probability that Pair Programming will add value to your process?

The environment into which your software is deployed probably has no impact on your team’s ability to use pair programming.

The environment into which your software is deployed may have a lot of impact on the value your team can gain from pair programming. If your team is unable to quickly fix bugs in the deployed environment, then avoiding deploying bugs may become more important. This is particularly true if the cost/impact of bugs is high. On the other hand, if you can quickly fix deployed bugs, and the cost of those bugs is not high, then the cost of pair programming may not be worth the return in fewer delivered bugs.

24. How does the Product Training in your context impact the probability that Pair Programming will add value to your process?

How your team trains people using your solution probably has no impact on your team’s ability to use pair programming.

25. How does the Support in your context impact the probability that Pair Programming will add value to your process?

How your team supports people using your solution probably has no impact on your team’s ability to use pair programming.

What does ChatGPT think?

(May 2023)Hey ChatGPT: What are good contexts and bad contexts for pair programming software code changes?

Pair programming is a software development technique in which two programmers work together at one workstation to develop code. There are certain contexts where pair programming can be beneficial, and others where it may not be the best choice. Here are some examples:

Good contexts for pair programming software code changes:

  1. Complex code changes: If the code changes are complex and difficult to understand, pair programming can be beneficial. It allows two programmers to work together to solve problems and can help identify potential issues or areas for improvement.
  2. Learning new skills: If a team member is new to a particular technology or programming language, pair programming can be a great way to learn from a more experienced team member. It allows for knowledge transfer and can help bring new team members up to speed quickly.
  3. Collaboration: If your team values collaboration, pair programming can be a great way to encourage teamwork and knowledge sharing. It allows team members to learn from each other and improve their skills.

Bad contexts for pair programming software code changes:

  1. Tight deadlines: If you’re working on a tight deadline, pair programming can slow down the development process. In some cases, it may be necessary to work individually to meet the deadline.
  2. Simple code changes: If the code changes are simple and straightforward, pair programming may not be necessary. It can be a waste of time and resources to have two team members working on small changes.
  3. Introverted personalities: If one or both team members are introverted or prefer to work alone, pair programming may not be the best choice. It’s important to consider the personality and work style of each team member before deciding to pair program.

Overall, pair programming can be a valuable technique for software development, but it’s important to consider the specific circumstances of each project before deciding to use it.

Questions to ask your team about Pair Programming:

  • Should we require all coding to be done as pair programming?
  • Should we require some coding to be done as pair programming?
  • Should we allow any coding to be done as pair programming?
  • Should we invest resources in creating an environment to facilitate pair programming?
  • Should we invest resources in learning how to make pair programming successful?