Pair Programming

Two women look at computer

One coding concept that helps novices and professionals alike is pair programming. In agile contexts, pairs would typically work at one computer, with one developer driving or writing the code and one reviewing it and giving feedback; the two swap places often during the process. Having two people looking at the same code helps pros write more efficiently and effectively, and beginners can learn a great deal while contributing new ideas.

Pair programming is also particularly helpful when collaborating on remote projects where you don’t have the luxury of being in the same room or office as your team.

Now Midlothian Code will offer pair programming resources as a learning and project-building tool.

Cloud9

To ensure this will work both in person and remotely, we use an online resource that will be free for you, Cloud9:

Cloud9 provides a development environment in the cloud that allows developers to get started with coding immediately and collaborate with their peers. With 3 years of cloud IDE development experience and nearly half a million registered users, Cloud9’s mission is to unlock the benefits of writing software in the cloud.

Our team space can be found at c9.io/midlothiancode, where you will find team shared workspaces. Each workspace is 2 GB of hard drive space in the cloud, running Ubuntu, and often preloaded with a few useful tools. You have an editor (which can be configured to VIM/Emacs/Sublime if you prefer), terminal access, and a number of navigation and language tools to make coding and debugging easier.

Cloud9 Workspace Screenshot

You can request a team Cloud9 account or access for your existing account right here:

With an account from our team, you will not need to enter any credit card information, and your use will be free. You’ll have unlimited public workspaces and be able to create one private workspace without upgrading.

Making Workspaces

Once you have an account, click the + sign from your dashboard to create a new workspace. You’ll see a screen like this:

Cloud9 Create a Workspace Screenshot
Create a name and description of your choosing, and if you would like to pair on this workspace with Midlothian Coders, go ahead and list it under Team. Most of the workspaces you make will be Public, unless you’re working on proprietary code. If you already have a Git repository you’d like to pull from, enter the Git URL to make it easy, and choose either a template or a blank workspace if none of the configurations make sense for what you’re making or working with.

Sharing Screens

Once you have Cloud9 set up, if you would like to pair program, it’s pretty easy:

Both (or all) people need to be viewing the same workspace. The creator of the workspace can invite the others by clicking the Share button in the upper right of their screen, which will open the following prompt:

Cloud9 Share Prompt Screenshot

Under Invite People, the creator enters the username or email, toggles to RW (read and write) access, and clicks Invite for each guest.

Alternately, the guests can request access by clicking Request Read/Write Access in the bar across the top of the intended workspace, which will notify the creator to accept.

From this point, all members with read/write access can make and view changes to the code and workspace and even share the terminals in real time.

Communication is Key

No true pair programming environment is complete without some form of communication between those driving the code and the guests reviewing it. In Cloud9, you’ll find this tool initially on the right hand side. Click the Collaborate button to pull out a menu showing who has access to the current workspace as well as an ongoing chat between programmers. This enables members of pairs or groups to ask and answer questions, switch control, and work more harmoniously.

Cloud9 Collaborate Screenshot

Announcements

You can pair program with any number of other coders, but be sure to let people know that you’re free either with a workspace or to join one. The easiest way is through Slack, since it’s already being used for quick communication.

A channel, #pairing, has been set up within Midlothian Code specifically for announcing you’re opening a pair programming session or that you’re interested in joining one. Be sure to share your workspace’s URL or name if you’re hosting the session so others can join. You can announce sessions immediately and see who’s free or schedule them for a future time.

Alternately, if you want to work with specific individuals, you can direct message them right from Slack to hammer out the details.

Don’t have access to Midlothian Code on Slack? Request an invite here:

Help and Extra Features

Cloud9 is very well documented, which should help answer most questions.

As you get more familiar with Cloud9, be sure to check out additional tools that can help you do better work. You can create, clone, and manipulate Git repositories from here, and there are useful integrations like GitHub and ways to tweak Cloud9 to serve you better. Play around, learn something, and have fun!

Have an unanswered question? Ask it in the comments, and I’ll point you in the right direction.

Comments

  1. Important: pair programming does not necessary benefit everybody as all people are different and some learn faster when they go alone.
    And this approach, if more and more companies jump on the bandwagon, is not necessary good for the future of programming as profession: http://sceptical-meerkat.blogspot.co.uk/2016/12/pair-programming-whats-in-it-for-me.html

    1. Thank you for sharing, as I hadn’t heard of a company that pairs 100% of the time, even just to train junior developers.

      I would like to clarify that while everyone is different and the bulk of a person’s learning programming should be either independent or through a curriculum, when done properly, I firmly believe pair programming can benefit anyone. While it’s good for newer developers to learn best/common practices from more experienced ones, it isn’t supposed to be the main way to teach someone code. Instead it’s best as a way for each programmer to get to see how someone else approaches a problem or piece of code, make it easier to spot bugs, and give an opportunity for programming styles to blend as each makes their contributions. After all, no one person generally creates and maintains a software monolith alone.

      Even the traditional two people in front of one computer is no longer necessary. There are numerous tools for sharing screens and IDEs, where pair programming can be done from different desks, offices, even countries, and many of these tools offer blame records or coloring to see who coded what.

Leave a Reply