A portrait of Duncan McClean
26 Jan, 2023 3 min read

Github Copilot

On 29 June 2021, Github announced their newest tool Copilot was available for preview. Since then, after a lot of testing and feedback, it's become available for public use under a subscription to developers everywhere.
laptop screen with coding

What is GitHub Copilot?

Copilot is a machine learning-based tool that provides in-line suggestions to developers as they work. It uses the data from thousands upon thousands of open-source projects and uses that to provide suggestions and ideas that it thinks make sense based on the context of your codebase.

It was created with the intention to reduce the amount of boilerplate code (repetitive code that is common to lots of problems) that developers write - allowing them to focus on the critical and novel problems they encounter.

In my experience, it's allowed me to do just that, and its integration with VSCode has made it a pleasure to use.

How does it work?

Copilot interacts with your code in two ways:

  1. Inline autocomplete

  2. Comment based suggestions

1) Inline Autocomplete:

This is where Copilot examines the line of code you are currently writing and assesses the current context. It then provides a solution it thinks makes sense next to the code you're writing. For example:

code showing copilot auto suggestion

I only had to write 'function primeNumber', and the grey text is Copilot giving its best estimation for what it thinks you want to write.

The less you provide, the less accurate it tends to be. But given some extra detail, it tends to be precisely on the money. As a developer, this saves you oodles of time.

2) Comment-based suggestions:

When you learn to code, you are often taught first to outline your solutions in pseudocode.

That is, write what you want the code to do in plain English. This is where Copilot shines.

Provide it with a comment on the outcome you want, and it will interpret it and translate it for you.

code showing copilot suggestion

A good percentage of the time, it will create a very accurate guess, and even when it doesn't, it's often a nice starting point for you to work from.

Final thoughts

Ultimately, Copilot isn't supposed to replace developers, nor really can it. It's unable to take a list of user requirements and turn them into a fully-fledged program the way a developer can, as it has a limited understanding of exact needs. But that's not what it's for. It's another toolkit in a developer's belt that can reduce the busywork of programming and give the gift of time for programmers to get on with the exciting stuff.

Are you ready to work on your new website or web application? If so, why not explore how one of Steadfast Collective's expert developers can help you today - get in touch and begin the conversation.

Software

More Articles