9.2 Working in teams

The daily reality for most developers is that they are collaborating on solutions as part of a team. There are many tools and techniques that can help you to more successfully manage that collaboration, especially when team members are working remotely.

# Pair Programming

Software development requires you to frequently alternate your attention from the broader solution structure to the syntactical details of the current function you are writing. The idea of pair programming, is to divide these roles between two developer working in tandem.

From Wikipedia ...

Pair programming is an agile software development technique in which two programmers work together at one workstation. One, the driver, writes code while the other, the observer or navigator, reviews each line of code as it is typed in. The two programmers switch roles frequently.

While reviewing, the observer also considers the "strategic" direction of the work, coming up with ideas for improvements and likely future problems to address. This is intended to free the driver to focus all of their attention on the "tactical" aspects of completing the current task, using the observer as a safety net and guide.

This can be a tremendously effective technique, but it takes practice to do it well.

Tip

Pair programming is sometimes used in technical interviews.

# Read this guide

The article On Pair Programming (opens new window) published at martinFowler.com provides an excellent primer on how to do pair programming well. Take some time, right now, to read this article and discuss it with your partner.

# Pull requests and code-review

Another common practice in team development comes from the use of git for source code control. GitHub, Gitlab and BitBucket all support the pull-request/merge-request code review workflow. This provides a safe mechanism for the team to review and discuss proposed code changes from a working branch before they are merged into the main branch.

# Resources

# Protecting the main branch

One important step is to turn-on some protections (opens new window) on your GitHub main branch. In particular you want to ensure that no code is allowed to be directly merged into the main branch without a pull-request. Secondly, in a team you should require at least one other team member to approve the pull-request before it can be merged.

# Lab activity

Practice Repo (opens new window) With this repo, here is what we are going to do.

  • clone this repo
  • create a new branch with your name git checkout -b [your name]
  • add a Markdown file with your name
  • add a note inside that file
  • git add, git commit, and git push origin [your name] your new branch back to the repo.
  • Go back to the repo and create a pull request asking to merge your branch into main.

After you have done that, try to repeat the process with your partner for the React-NextJS assignment.

And then, practice pair programming.

Last Updated: : 11/5/2021, 3:25:50 PM