GitHub Copilot blew my mind on a code-along exercise
Tags: webdev, programming, productivity, discuss
Published: 2021-11-04 21:47:46

GitHub Copilot has surprised me beyond what I could have ever expected. I guess artificial intelligence is more capable than I thought initially, and this is a great example of how it can help us to code faster and better.

My idea about using GitHub Copilot as a web developer was that it will be suggesting function and method names with a hint of what the method could do given a comment previously written by the programmer. My mind exploded 🤯 when it actually suggested the full code on a video code-along exercise I was doing on Ruby!

## The guessing game

I honestly had forgotten I installed the Copilot extension on VSCode (I have been very busy lately [catching up on my new job](https://dev.to/colocodes/how-ive-got-a-web-development-job-one-week-after-publishing-my-portfolio-3o6g)). On a Saturday morning, I started with my regular studying ritual: I opened VSCode on half of the screen, which I had to update, something that included the _enabling_ of GitHub Copilot (more on that later), and on the other half I opened a Udemy course I'm doing on Ruby on Rails: <a target='new' href="https://click.linksynergy.com/link?id=LO030NrbM0E&offerid=507388.519442&type=2&murl=https%3A%2F%2Fwww.udemy.com%2Fcourse%2Fthe-complete-ruby-on-rails-developer-course%2F">The Complete Ruby on Rails Developer Course</a>. The day before, I started working on a method and I was planning on continuing doing so.

So, halfway through the video tutorial, I started typing away on my VSCode editor:

```Ruby
def a
```

I didn't have the chance to finish typing the name of the method that I was defining in Ruby, when suddenly, out of nowhere, GitHub Copilot suggested the rest of the code: not only the name of the method, but also its parameters, a loop, variable names, a return statement, and the whole logic. But that is not all: **every single character was the same as the code in the Udemy video!** 🤯 It even suggested a part of code that was further ahead on the video.

![GitHub Copilot blowing my mind](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z7shl9cy6pw3gn76kptz.png)

![GitHub Copilot blowing my mind](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/13nxoizs3ia5bwjqpwwa.png)

I couldn't contain my excitement, and I started smiling like a 6-years-old on a Christmas morning.

But then I thought: 🤔 "I should disable this because otherwise, I won't be doing any code by myself, which is the whole point of the coding-along!".

Even though I can see how useful and amazing this tool is, I won't be using it during my coding-along exercises. But I will definitely use it when building projects! It speeds up the development process greatly and helps to reduce mistakes.

## What is GitHub Copilot

GitHub Copilot is an extension that can be installed in most IDEs and text editors (including VSCode) and suggests lines of code, or entire functions, based on the [OpenAI engine](https://openai.com/). As it is trained on billions of lines of public code, I'm guessing the code from the Udemy video is on a public GitHub repository, allowing Copilot to match my code with the code in its database and make suggestions accordingly.

![How GitHub Copilot works](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hns33svjv215w60jnay5.png)

You can learn more about this AI pair programmer on its [official website](https://copilot.github.com/).

## How to get GitHub Copilot

To get GitHub Copilot you need a GitHub account, and to sign up to the waiting list. It can take a while to receive the invite to start using it (in my case was around 4 weeks). You can request the invite on [GitHub Copilot's signup page](https://github.com/features/copilot/signup).

## The future

Is GitHub Copilot working for us, or are we working for it? This tool uses our code to, in turn, suggest code right back to us.

<img width="100%" style="width:100%" src="https://media.giphy.com/media/h4Hz4w9Jgrc1EY9VkL/giphy.gif">

So, the question many are pondering is: are we feeding a monster that will replace us as developers and unleash the power of [Skynet](https://en.wikipedia.org/wiki/Skynet_(Terminator)) on the world?

Or is it just a tool to improve our work, and still lacks the creativity that we, humans, have when coding?

---

🗞️ **NEWSLETTER -** _If you want to hear about my latest articles and interesting software development content, [subscribe to my newsletter](https://chipper-designer-8106.ck.page/1a819bffe8). **I will be giving away a Udemy course among my newsletter subscribers** if we go over 100 during the month of November 2021!_

🐦 **TWITTER -** *Follow me on [Twitter](https://twitter.com/DamianDemasi).*