DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 967,611 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

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

Posted on • Updated 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. 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.

Top comments (40)

Collapse
 
yoinx profile image
Joe Schubert

Wait... So all it took to impress you was for it to auto complete a code along exercise (which is very likely committed to someone's GitHub somewhere)?

I mean, I've been fairly impressed with CoPilot overall myself.... But you're basically saying "wow it was able to auto-complete code that I was about to copy from a lesson before I could copy it."

I don't get why that's impressive or article worthy.

Collapse
 
colocodes profile image
Damian Demasi Author • Edited on

It’s impressive for me because I jumped from an auto completion of a single word (without using Copilot), to a fully featured Ruby method directly related to an online course I’m doing, and I just had to type four letters.

Collapse
 
yoinx profile image
Joe Schubert

Yeah. The difference though between it being "notable" and "meh" is that you were getting ready to type code that's already pre-existing, character for character. It's pretty impressive at what it does... The example that you gave though is an example of it giving you code that was probably used, verbatim, in it's AI training samples. Which honestly isn't all that impressive that it was able to guess that.

Thread Thread
 
colocodes profile image
Damian Demasi Author

πŸ™‚

What would you consider being a notable feature of this tool?

Thread Thread
 
yoinx profile image
Joe Schubert

I mean, the autocompletion features are notable. Just more notable if you're coding something fresh or "off the cuff". It suggesting premade code that you're typing off a guide ... Not as much.

Thread Thread
 
nssimeonov profile image
Templar++

Joe, it's been a while since you were a student, right? I was thinking to comment something like you, but when I do they call me a****le and I end up in pointless argues with students and juniors.

On a side note: TabNine and Codota are similar to CoPilot and I ended up uninstalling both. I still don't have strong opinion about CoPilot yet.

Thread Thread
 
colocodes profile image
Damian Demasi Author

Why did you uninstall them?

Thread Thread
 
nssimeonov profile image
Templar++ • Edited on

Not much value when you are usually the person answering the questions on StackOverflow including your own. It was burning CPU cycles and slowing down my computer without anything that useful. Decided I like the classic-style autocomplete better.

Thread Thread
 
colocodes profile image
Damian Demasi Author

You are on a different level altogether! :D

Collapse
 
nombrekeff profile image
Keff

I just think of it as a smarter snippet tool/autocomplete. In my experience and for the use I gave Copilot, I was not impressed and it did not help me much.

I use TabNine and that works fantastic for me, copilot not as much.

I personally don't think it will replace us whatsoever, it will just support some of us like any other tool.

Collapse
 
colocodes profile image
Damian Demasi Author

Interesting! I’ve used Tabnine and I didn’t find it much helpful. I guess it will depend on the programming language we are using and the specific project maybe πŸ€·β€β™‚οΈ

I’m in the same boat as you. I think, in the end, this is just another tool, and the programmer will not be replaced by it.

Collapse
 
nombrekeff profile image
Keff

I too didn't find it that useful initially, but after using it for around 1 year os so it really started to understand my way of coding and the projects.

Thread Thread
 
colocodes profile image
Damian Demasi Author

I guess it won't hurt start using it again. I'll try it once more!

Collapse
 
beebase profile image
Maarten Berkenbosch

Keep on dreaming. Maybe programmers will stay, but they will become a hell of a lot more efficient. Like 1 programmer doing the work of 100 (or whatever). It's a pattern that arises in every field AI has entered.

Collapse
 
nombrekeff profile image
Keff

Yeah I somewhat agree. In the mid/long term probably yes, it will make most of us redundant, but we will not be replaced as the question in the post asked. I also don't think we should worry much still, at least not about copilot.

Thread Thread
 
beebase profile image
Maarten Berkenbosch

I also don't see it happening any time soon. However, AI has this exponential thing which makes our guess as good as anyone else's. We may still be on the shallow curve for years, but boy, when it steepens, I'm sure things will change rapidly.

Collapse
 
assayeassefa profile image
AssayeAssefa • Edited on

Absolutely. Also, with efficiency comes the need to trim away the unneeded heads: entry levels, juniors and even some mid levels.

Collapse
 
spaceportdevelopment profile image
Spaceport Development

I use Tabnine and GitHub Copilot... A very strong combination ☺️

Collapse
 
colocodes profile image
Damian Demasi Author

Nice!

Collapse
 
jcolag profile image
John Colagioia (he/him)

My run-through and assessment---which I wrote up on my blog but haven't had time to republish here---was similar but less generous. If you're a fledgling programmer who writes (bad) comments along the lines of "sort the input array from low to high, using the mergesort algorithm," it works as an excellent assistant...but you're still the senior developer in the relationship.

However, once you try to put it to real work, you're suddenly stranded in a Douglas Adams novel, where the AI tries to tell you what you should do instead, then flubs that task, more often than not.

Collapse
 
drazisil profile image
Drazi Crendraven

This! ☝️

Collapse
 
colocodes profile image
Damian Demasi Author

Agree. I started using it at my work, and so far is far from impressive.

Collapse
 
optimisedu profile image
optimisedu

I also like TabNine. I love autopilot for say "function fibonacciRecurively(n)" it will give me a recursive Fibonacci.
Or "const howManyPoke//autofils mon = 151" -- I don't think the second example is good.

These were known things that have been debated and evolved. A better example I am working with web audio API, and have a very orderly way or doing things to make a modular synthesiser. CoPilot can make sine wave oscillators. Great, but I can do that on autopilot myself and copilot doesn't use MY style.

In short copilot is great for coding challenges. As mentioned earlier many people will have deployed your courses code to git. For new functions with don't have a regonised pattern copilot stalls - or if you are extremely specific and lucky you might get what you need, or a commit somebody made years ago which just doesn't work.

Collapse
 
colocodes profile image
Damian Demasi Author

I agree with your oppinion. GitHub copilot can be helpful, but it's not perfect.

Collapse
 
turry profile image
Turry

For it to work, it needs code and that code is from us so it won’t replace developers until every sort of code is made in the world of programming.

Collapse
 
turry profile image
Turry • Edited on

I have to admit that that’s the smartest thing I’ve said in a while πŸ‘€

Collapse
 
colocodes profile image
Damian Demasi Author

Agree! And as the world of programming is ever expanding, it will take it forever...

Collapse
 
drazisil profile image
Drazi Crendraven

I'm glad you went the disable route. That was my first thought you said it filled in everything. Same reason they tell us not to copy and paste the code, we need to train our brains to be autopilot. Then we have space to learn more! 🀣πŸ€ͺ

Collapse
 
colocodes profile image
Damian Demasi Author

Exactly! πŸ˜…

Collapse
 
volker_schukai profile image
Volker Schukai

I have been working with copilot and intelliJ for 1 week now.
I am not really convinced yet. Let's see if this still becomes successful.

Collapse
 
colocodes profile image
Damian Demasi Author

I think using it on work related code is not as impressive. Maybe that’s because of the code being too customized to a specific need.

Collapse
 
volker_schukai profile image
Volker Schukai

that is possible.

Collapse
 
thesecuritydev profile image
David

I think Copilot is the perfect name. I'm still in control, but it helps me out on tedious or repetitive tasks. Where it really shines though is in writing code that I would have had to Google to do myself. It's probably saved me hours of work in cases like that. It's suggestions are often best practices and help me learn how to do things more efficiently. I love it so far!

Collapse
 
colocodes profile image
Damian Demasi Author

This! Improving the code quality is one of the best use case I can think of about this tech.

Collapse
 
ifierygod profile image
Goran Kortjie

I don't trust it.

Collapse
 
drazisil profile image
Drazi Crendraven

"Deploy the firewall, Hal!"
"I'm sorry, Dave, it doesn't meet the average coding style"

Collapse
 
colocodes profile image
Damian Demasi Author

πŸ˜…

Collapse
 
faraazahmad profile image
Syed Faraaz Ahmad

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

Love that attitude!

Collapse
 
colocodes profile image
Damian Demasi Author

Thanks!

Collapse
 
troke12 profile image
I Made Ocy Darma Putra

Can't wait to use this, this is help me for tired searching an examples

Get a better DEV experience!

Sign in to your DEV account for a more curated experience.

You're welcome to keep lurking, but the signed in experience is more delightful.