GitHub CoPilot, Code Automation, and Software Health

August 15, 2022

At Instana, we naturally talk a lot about strategies for automating operations, but this is just one part of the picture. Developers can also benefit from increasingly intelligent forms of automation.

By now you’ve likely heard of GitHub Copilot, which is the most popular in a growing field of automated code assistance tools for developers.

In our eBook Achieving Software Health, we discuss how code assistance tools can improve maintenance and repair of services and applications. Let’s take a closer look at some of those tools…

Commercial Code Assistance Tools

GitHub released the first iteration of CoPilot in October 2021. Since then they have steadily added extensions for many popular editors. Amazon announced CodeWhisperer, which is currently in a preview program, on June 23rd this year.

GitHub Copilot is currently the easiest to get started with — if you don’t mind paying for it — as the only requirements are a GitHub account and a compatible editor. CodeWhisperer requires interested developers to apply for the preview program, although being approved within a few days is common.

Both of these tools offer a very similar feature set. The core feature is the ability to complete entire functions or even modules based on a code comment describing the developer’s intent. CodeWhisperer depends more on these comments, while CoPilot is more integrated into the editor’s typeahead autocompletion.

CoPilot is almost aggressive in how quickly it will attempt to complete a line or definition, but you quickly adapt to the code hints. It is uncanny how well CoPilot can guess the name of a new function or variable based on context as soon as you begin the declaration.

With either tool, you have the option to reject a suggestion or open a context menu to choose from a selection of alternative suggestions, which provides more experienced developers with the ability to choose their preferred solutions.

Things Code Automation Tools Do Well

So what can we do with this super-powered autocomplete? While it’s possible to have these tools build almost an entire (small) program from just a few comments, that is not how most developers will want to use them.

If basic autocomplete as we’re familiar with in IDEs is like an autopilot — capable of maintaining a straight course and heading — then the CoPilot name is spot on (although “CodeWhisperer” just sounds cool, doesn’t it?). It is a helpful aide, almost like having an always-available junior pair programmer.

In this role, the code completion tools can look up documentation and combine that with the context of your program to create the exact suggestion you need.

For junior developers, or even experienced developers working in an unfamiliar language, there is a didactic nature to the experience that informs and educates through assistance and suggestion.

Another excellent use for AI-assisted code completion is in writing boilerplate code. You, the developer, provide the intent and the architecture, and the code completion tool handles the bulk of the typing. In fact, according to Microsoft, CoPilot now writes 40% of the code on files where it has been enabled.

Open Source Options

In addition to the commercial tools, a number of open source ML-driven code completion tools are in active development. The most general purpose of these is GPT Code Clippy, which has the aim of being a complete open source alternative to one of the commercial code assistance tools. It is based on the GPT-3 model and has an extension available for VSCode.

Other tools exist for specific editors:

  • ASM Dude
    A Visual Studio extension for Assembly

Code Completion for Software Health

You may be asking, “won’t these tools just enable garbage code to be generated that will increase our technical debt?”

No.

Unlike the boilerplate generators built into many popular frameworks, these code completion tools provide a conversational interface that leaves the developer in the driver’s seat at all times.

This is the best kind of automation — the kind that reduces tedium for developers and operators and leaves them free to focus on the higher order solutions.

Play with Instana’s APM Observability Sandbox

Start your FREE TRIAL today!

Instana, an IBM company, provides an Enterprise Observability Platform with automated application monitoring capabilities to businesses operating complex, modern, cloud-native applications no matter where they reside – on-premises or in public and private clouds, including mobile devices or IBM Z.

Control hybrid modern applications with Instana’s AI-powered discovery of deep contextual dependencies inside hybrid applications. Instana also gives visibility into development pipelines to help enable closed-loop DevOps automation.

This provides actionable feedback needed for clients as they to optimize application performance, enable innovation and mitigate risk, helping Dev+Ops add value and efficiency to software delivery pipelines while meeting their service and business level objectives.

For further information, please visit instana.com.