CodeNewbie Community

Cover image for GitHub Copilot blew my mind on a code-along exercise
Damian Demasi
Damian Demasi

Posted on

GitHub Copilot blew my mind on a code-along exercise

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). 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: The Complete Ruby on Rails Developer Course. 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:

def a
Enter fullscreen mode Exit fullscreen mode

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

GitHub Copilot blowing my mind

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. 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

You can learn more about this AI pair programmer on its official website.

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.

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.

So, the question many are pondering is: are we feeding a monster that will replace us as developers and unleash the power of Skynet 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.

🐦 TWITTER - Follow me on Twitter.

Discussion (0)