simon_bisson
Contributor

Remote coding with Visual Studio Live Share and GitHub

analysis
Mar 24, 20207 mins
Software DevelopmentVisual Studio

Using Microsoft’s development tools for remote working and social coding

remote worker student working from home striped socks laptop
Credit: Thinkstock

If you’re not working from home already, you most likely will be very soon. The question then is, how can we use the tools we already have to still be able to build and ship code?

VPNs and other remote access technologies can link our home networks to on-premises source code repositories and other key devops tools, offering secure connections. A remote development workstation doesn’t need to be completely isolated from key resources, though it may need additional security policies to ensure separation between personal information and work resources.

Connectivity is important, but it’s likely to be the least of your problems. We’re social animals, and much development work needs more than one pair of eyes. Social distancing policies mean that many of the techniques required for modern agile development are hard to implement. Although we have the option of conferencing tools such as Teams or Zoom for daily video standups, we still need to find ways of replicating the regular one-on-one interactions of code reviews, pair programming, or collaborative debugging.

Secure social coding with GitHub Enterprise

One option is to move to a platform such as GitHub for your code. Making GitHub part of your software development lifecycle is a lot easier with the release of GitHub Actions, giving you integration points with the rest of your CI/CD (continuous integration/continuous delivery) pipeline and delivering final code into artefact repositories. With GitHub’s planned acquisition of NPM, you’ll soon be able to build a single JavaScript development pipeline.

GitHub (and other git tools) provide a platform for social coding, making changes more visible, and integrating test into code submissions. Working from home, you can replicate code repositories to get access to colleagues’ work, make changes, test code, and run local builds, before sharing your code back to a main branch via a pull request. It’s a familiar way of working, proven across thousands of open source projects. Code changes are visible, and team members can make comments on any commit, with additional tools to support finding common security bugs or dependency issues.

If keeping code on-premises is an issue, for regulatory or intellectual property protection reasons, you can run GitHub on your own network using GitHub Enterprise. If you’re using a single corporate directory for single sign on, support for the open SAML authentication protocol should simplify integration, allowing remote users to sign into their VPN and start working. GitHub Enterprise Cloud can be used with private repositories as a managed service on GitHub’s own infrastructure, with the same security tooling.

Collaborating on code in Visual Studio Live Share

Shared code is one option, but often you need direct collaboration. Pair programming and other, similar techniques put two developers at the same keyboard, working together to solve problems and debug code. That’s not possible when individuals are working from their homes. However we can share our code bases with each other, linking our IDEs to give a shared development experience without having to be in the same place.

If you’re using Visual Studio, you’ve already got access to a set of powerful collaboration tools, baked into the Visual Studio platform. One aspect is support for the git protocol and GitHub; another is its code sharing tools, Visual Studio Live Share. Available in the full Visual Studio IDE on Windows and on Macintosh, as an extension for Visual Studio Code, and in a new Web-hosted code editor, it’s a quick and easy way to share and collaborate in code.

Working with Live Share

Getting started with Live Share is relatively easy. All you need to do is add support for one of the Live Share-enabled workloads to Visual Studio 2019. If you’re using Visual Studio 2017, you first need to install an extension from the Visual Studio marketplace. Once the appropriate features have been installed, restart Visual Studio before connecting to the Live Share service. You can use your existing Visual Studio account with Live Share, or you can sign in with a new account if you want to keep Visual Studio and Live Share separate. Working with Visual Studio Code is very similar.

Once logged in, open a project or solution as normal. It’s worth using .gitignore files to hide folders you don’t want to share; the default is to give access to all the files in your project to collaborators. You can hide files (they’re not shown to guests) or exclude them (they’re not accessible when stepping into them from the debugger).

To share, click Live Share in your IDE to get an invite link, which you can then send to a colleague. Sessions don’t need to be read/write; they can be read-only. This is a useful option for giving a guided tour of your code base or walking someone new to a project through the code and telling them what each module does and why. As the owner of a share, you can open shared terminals or set focus, so that your collaborators only see the code you’re showing them.

Debug in your choice of development tool

Co-debugging is a useful feature, for security code only runs on the host machine, using the standard Visual Studio debugging tools. Collaborators are joined to the debugging session using their own viewers to see the debugging information so they can make their own investigations into application state. Only the host can step through the debugger, though guests are able to add and remove breakpoints to focus on areas that interest them. Similarly, Web apps can be launched in a secure environment on guest machines so that everyone gets their own view. If your code needs a local server, it too can be shared with collaborators, using an SSL tunnel between machines.

One key feature of Live Share is IDE independence. I might be using Visual Studio on a Windows PC, you might be using Visual Studio for Mac or even the Web view; all get access to my code base, and changes will be saved to my PC. You can even compile code, run it, and get access to the debugger. If a problem needs more eyes, as many as 30 people can join a single Live Share session, bringing an ad hoc swarm to try and solve a problem. The same technique can be used for small team or group development, where, once connected to Live Share, individuals can work on specific tasks and then bring in collaborators when needed.

The one thing missing in Visual Studio Live Share is a chat tool. There’s no reason you can’t set up a Skype call or a Teams meeting around a session to capture discussions and actions. If you’re only using Visual Studio Code, its Live Share implementation can be used to share voice. However, it’s better for quick collaborations; more complex interactions are best managed in other tools.

Using social coding tools should help make working from home in a time of social isolation not so isolating. We can share code, even share our development environments, while wrapping it in familiar chat and collaboration environments. It’s not business as usual, but at least it’s a way to stay on top of our code wherever we may be.

simon_bisson
Contributor

Author of InfoWorld's Enterprise Microsoft blog, Simon BIsson prefers to think of "career" as a verb rather than a noun, having worked in academic and telecoms research, as well as having been the CTO of a startup, running the technical side of UK Online (the first national ISP with content as well as connections), before moving into consultancy and technology strategy. He’s built plenty of large-scale web applications, designed architectures for multi-terabyte online image stores, implemented B2B information hubs, and come up with next generation mobile network architectures and knowledge management solutions. In between doing all that, he’s been a freelance journalist since the early days of the web and writes about everything from enterprise architecture down to gadgets.

More from this author