Home / Blog /
4 ways to perform pair programming on VS Code
//

4 ways to perform pair programming on VS Code

//
Tabnine Team /
6 minutes /
April 25, 2022

Pair Programming has been around for a while. The rise of remote working across the globe made this concept even more interesting for developers as it allows them to code concurrently, no matter where they are. Yet still, many think it is as simple as “two people coding using a single computer.” However, it’s not as simple as that, and the benefits are also not immediately apparent. It delivers more advantages in the medium- and long-term. For instance, pair programming is essential for cooperative teamwork and developing high-quality software products.

What is pair programming?

Pair programming is an Agile methodology in which two or more developers work together on the same task at one workstation. Pair programming needs at least two developers, and we can see two roles there: driver and navigator. The driver is the person who does the coding and implementation. The navigator is the person who looks for syntax errors, mistakes, and typos by reviewing each line of code when the driver is typing.

Developers continue the work by switching roles frequently. Pair programming is a productive and efficient way to develop software where developers can transfer their knowledge and experience with each other. Leading companies use this approach to improve their productivity and code quality.

Source: reddit

Source: reddit

Benefits of Pair Programming 

Pair programming can have significant impacts on software development. There are several strong reasons why you should consider this methodology.

Share knowledge

Each developer has their strengths and weaknesses. Suppose one is a newly joined engineer who is an expert in some coding stack such as MERN with an experience of more than three years. Another developer is an engineer who works at the organization having three years of experience in the product domain. He knows the executing code, services, database table structures, debugging process, and main workflows.

They can get instant feedback and suggestions, share knowledge about the software product, and share programming skills with their peers by working together on their code. In that case, pair programming will be an excellent way for them to fill some potential knowledge gaps and learn directly from each other. Sharing knowledge also facilitates mentoring, especially when one of the developers is more experienced.

Improve code accuracy

Programmers make common mistakes while coding, such as implementing dead codes, inefficient code blocks, bugs, vulnerabilities, syntax errors, and typos. Yet, in pair programming, another developer is looking at you and sharing his knowledge on best coding practices, so the code is likely to have fewer bugs and mistakes.

Enhance productivity

The most important benefit gained by pair programming is enhanced productivity. If a single programmer implements a solution, they can sometimes struggle with the code, so it may take longer than the estimated time. Hence it is more productive to use two developers as one can monitor the other and help him in struggling areas.

Moreover, developers can identify potential bugs and performance issues in the early stages. Because solutions are evaluated before implementation rather than after they’ve already been implemented and deployed, developers avoid wasting time changing code at the last minute.

Strengthen relationships

Pair programming enables you to learn from your colleagues and share experiences. Pairing more senior developers with junior developers can also help them integrate better with the team. The time spent working together on the same project will strengthen their relationships, and a united and motivated team is always key to success.

Source: MartinFowler

Source: MartinFowler

4 Ways to Perform Pair Programming on VS Code 

Microsoft Visual Studio Code is the most popular IDE these days, and there are various tools developers can use on VS Code to perform Pair Programming. 

Remote sharing tools

One developer opens up the code and shares the screen with another using a remote sharing tool such as Teamviewer, GitDuck, Anydesk, Codenvy, and Microsoft Teams. Developers can then request access to use the desktops of other developers and write code.

Remote sharing tools are easy to set up. However, there are cons to bear in mind. Because both developers can’t develop simultaneously using the same desktop, one has to wait until the other completes his task. Collaboration isn’t as seamless and practical as developers would want. Plus, it may take them longer to code and they have to continuously wait on one another. 

 

Visual Studio Live Share

Visual Studio Live Share is another tool you can use to perform pair programming without cloning or installing dependencies on your code. Here, you create a collaborative session and share it with your partner. Your partner joins with the provided invitation link and sees your workspace in their code editor. Then your partner gets access to your codebase. He can navigate and edit code or perform any changes in the codebase. You can see your partner’s cursor and what he is typing when you edit the same file.

Source: VisualStudioLiveShare

Source: VisualStudioLiveShare

 

You need to download the Live Share Extension Pack from VS code Extension marketplace to Integrate Live Share with Visual Studio code. After that, you need to sign in. There are two Sign-in options: log in with a Microsoft or GitHub account. Click the Sign In button in the bottom status bar with the person icon to log in. After signing in, you can create a session to share with others. Start by clicking your username in the bottom status bar and choosing Start Collaboration Session from the available options.

You can also open the Command Palette (CTRL+SHIFT+P on Windows, CMD+SHIFT+P on Mac) and type Start the Collaboration Session. Then you will get a notification that your invitation link has been copied to the clipboard. You have to share this link with your partners and invite them to your session. Click your username in the bottom status bar and choose Join Collaboration Session from the joining perspective to accept an invite. Enter the collaborative session link sent to you by the inviter when prompted.

 

This method has certain limitations: VS code Live Share is locked to 5 concurrent users, and it can only be used if both developers use the same text editor.

Pair Programming tools

Apart from the two platforms mentioned above, there are tools built specifically for Pair Programming that developers may want to consider. Pair programming tools offer many advantages:

  • You can instantly connect and share knowledge with your partner or team regardless of where your partner is.
  • They are easy to set up, and most tools support audio and video and chat.
  • Can be integrated with GitHub, Bitbucket, GitLab easily.
  • Most pair programming tools are either open-source or available for free.

However, there are some cons too:

  • It is difficult to speed up your coding to improve the developments and deliverable times.
  • There will be too many code review rounds.
  • Most of these tools are limited to a particular text editor.

You can solve these problems using AI-assisted programming tools. Let’s check how to do it using Tabnine in the next section.

AI-assisted programming tools

Another way to perform pair programming is to use AI-assisted programming tools. AI-based tools help speed up the software development while ensuring code accuracy. Tabnine is a fantastic auto-completion tool that can deliver significant value to developers. It’s a free plugin that indexes your code and discovers statistical patterns to create customized indications/suggestions based on how you write your code on IDE.

Source: Tabnine

Source: Tabnine

 

You can easily download it in the VS code marketplace by searching “Tabnine AI Autocomplete.” Apart from that, Tabnine offers you the following advantages:

  • It is easy and secure to integrate codebase into remote repositories such as GitHub, GitLab, and bitbucket with AI assistant access.
  • Allows sharing of knowledge across different countries and time zones. 
  • Tabnine learns your code patterns and provides expert guidance to every team member at any time of day.
  • Helps reduce code review iterations and efforts.

Summary

The goal of any developer is to code faster and with as few mistakes as possible, which will result in a higher quality product in the end. Regardless of their chosen tool, both Pair Programming and AI-assisted programming can support developers and enable them to be more productive.