Published using Google Docs
Pair programmering
Updated automatically every 5 minutes

Pair programming

Two programmers work together:

Each 15 minutes the roles change.

This should produce better software with fewer bugs.

Take a short break every hour.

Version control: Git + GitHub

The pair must maintain a GitHub repository. One of the programmers creates a GitHub repository and invites the other programmer to collaborate.

The code must be pushed to GitHub at least every time the roles change (every 15 minutes).

This is to ensure that the code is available to both programmers at all times - even when one of the programmers is not present.

Testing

The software must be thoroughly tested:

  1. The REST controller(s)’ manager class must be unit tested using MSTest
  2. The REST controller(s) must be tested using Postman
  3. The front-end must be UI tested using MSTest with Selenium.

Tests can be written before writing the program (test first) or after - try both.

It is most important that the test is written very close to writing the program. Don’t wait a long time before writing tests.

Pair programming, using GitHub

This is an alternative to Live Share.

You still need to share audio and screen using Microsoft Teams or a similar tool.

Getting started

The first driver:

  1. Creates the project, including a local Git repository.
  2. Creates a GitHub repository
  3. Make the other programmer a collaborator
  4. Program for at most 15 minutes
  5. Commit to local repository
  6. Push to the GitHub repository.
  7. Use your browser to go to github.com to see that the repository is no longer empty.

The second driver:

  1. Clone the other programmers GitHub repository.
  2. Change the GitHub username + password to yours. You may want to use GitHub Desktop to change the username + password.
    However, do not change the remote repository URL: You still want to push to the other programmers GitHub repository - where you are a collaborator.
  3. Program for at most 15 minutes.
  4. Commit to the local repository.
  5. Push to the GitHub repository.
  6. Use a browser to inspect the GitHub repository, and check that it is updated appropriately.

Normal operation

The driver:

  1. Pull the most recent version of the source code from the GitHub repository. Use the command line c:\blah>git pull 
    or use GitHub desktop.
  2. Program for at most 15 minutes.
  3. Commit to the local repository.
  4. Push to the GitHub repository.
  5. Use a browser to inspect the GitHub repository, and check that it is updated appropriately.
  6. Change roles (new driver)

Warning: In pair programming the navigateur must not do any programming.

If the navigateur accidentally starts to program you might face merge conflicts.

Remote pair programming, using Live Share

Pair programming can be done remotely by applying different tools.

We normally program using Visual Studio and Visual Studio Code.

They both have means to share the editor:

With Live Share both programmers can write code at the same time. This is NOT the way to do pair programming. The driver writes code. The navigateur leads the way.

Talking to each other while pair programming can be done using Discord, Microsoft Teams or other tools.

Remote pair programming, using Microsoft Teams

I’ve heard that it is possible not only to show your screen to your programming partner, but also let the partner write on the screen. Share a single application, not the desktop.

However, I haven’t tried this feature yet...