Schedule‎ > ‎

12C Pair Programming

Pair Programming

Learner Outcomes

At the end of the lesson the student will be able to:

  • Describe how to complete an assignment using pair programming
  • Discuss the pros and cons of pair programming

^ top

Introduction to Pair Programming

  • Pair programming is a style of programming in which two people work together on one computer at the same time:
    • Exactly two people: not one nor three or more
    • Exactly one computer: not two or more
  • One person enters the code and the other reviews each line of code as it is entered


  • The person operating the mouse and keyboard is called the driver
  • The other person in the pair is called the navigator
  • The role of the navigator is to think about what needs to be done and where the project is going
  • The navigator duties may include:
    • Determining optimal algorithms
    • Analyzing the design and code to prevent errors
  • Each person "drives" about half the time:
    • Physically get up and move positions when switching roles to emphasize the change

Working Together

  • More than 75% of your time must be spent working on the projects together
  • The objective is to work together and to learn from each other
  • You cannot divide the work into two pieces with each partner working on a separate piece
  • If you are not both engaged in the process, you will not learn the material
  • People who do not learn the material fail the course
  • More information: Pair Programming on Projects

Why Pair Program?

  • Students who pair program report:
    • Higher confidence in a program solution
    • More satisfaction with programming
  • Instructors report higher completion and passing rates

Video Explaining Pair Programming (5.5m)

Fun with Pair Programming: a professionally developed video (10 minutes)

Fun with Pair Programming Worksheet: follow along during the video

Check Yourself

  1. True or false: pair programming typically results in fewer errors and programs take less time to complete.
  2. The job of the driver is to ________.
  3. The job of the navigator is to ________.
  4. To gain a different perspective on the problem being solved, after about 30 minutes change ________.
  5. True or false: in pair-programming, the person who owns the code is the person who wrote the code.

More Information

^ top

Best Practices

  • You may choose any other student in this class for a partner or you will be assigned a partner
    • You may NOT program with a person from outside the class
    • Often in the workplace, you will not have your choice of partner
  • Both of your names appear on the assignment
  • When choosing partners and working together, certain practices help you perform better
  • Pair-programmers are usually more successful when they have similar experience levels
  • However, pair programming can work with partners of different experience levels
    • The more experienced partner must be ready to mentor rather than just develop the program
  • Find a partner with whom you can easily exchange ideas
  • If you cannot work easily with someone, get another partner or work by yourself

The Rules of Pair Programming

Refer to the rules to verify you are pair programming correctly!

Pair Programming Non-Performance (source)

  • Silence immediately indicates a lack of collaboration
  • Disengagement when one member does not pay attention or does something else like email or texting
  • One member observes and offers little comment as they "watch the master"

Check Yourself

  1. True or false: there are no rules in pair programming.
  2. Indicators of poor pair programming performance include ________.
    1. one member is not paying attention
    2. one member observes and offers little comment as they "watch the master"
    3. silence
    4. all of these
  3. True or false: the rules of pair-programming require you to use only one computer at a time to edit and compile code.

More Information