First Look at Github CoPilot - AI Powered Programming

Published:

Yesterday I got the notification I had been waiting for. I had seen some demo's of Github Copilot and I was eager to play around with it. Before I talk about it and show some of what it's good at (vs what it's not good at), I wanted to calm the fears of those of you that are reading this and thinking oh no, this will replace my job. Maybe one day that will be the case, but this will be nothing more than a more sophisticated intellisense and not something that will replace your job, atleast in the next 10 to 20 years, so stop worrying. Maybe one day robotics/AI will replace all work, and our machine overlords will just pamper us while we sit and do nothing. But for now and in the immediate future, you can be assured that if AI starts replacing technical roles (which actually sounds scary that machines will start coding themselves, sounds like the beginning of the end), that there will be many other jobs replaced by that time, and mankind will likely need to grapple with if it's worth it before it gets to that point.

First thoughts - More than advanced intellisense

So if you get past those initial fears, lets look at Copilot and what can it really do? I've had it for less than 24 hours now, and I think where it's really going to be great help, is assisting the developer. I think it'll be great at replacing Stackoverflow usage. If you are not sure how to write a switch statement in typescript or python, you can use it to assist in writing the code you need. It's more than just intellisense! When I first saw it in a video broadcast by Jack Herrington, I thought, well this will just be a smarter intellisense, but its more than that, because it can write full functions for you. But that's where it ends, you have to know what you are trying to write, to get the best results out of it. There's always so much complexity in writing an application, that I don't see this getting to that point anytime soon. Here is an example below. I tried to have it create another fetch function in my personal blog code, it did pretty well, it knew it needed to extend the array returned to more than just one item. I'm assuming it reviewed the logic above and altered it, which is pretty impressive to say the least. It knew because I gave it the subtle naming hint with a constant that was plural vs singular, that I wanted similar code, but one with more items returned. Sounds awesome, but weirdly some times it just throws out garbage results as well. I think it'll take some more learning to improve, but here is the example:

Github Copilot Basic Example

That's a very basic example in that demonstration, but it can do more than just that. You can write comment instructions, and it'll use that information to create the function (or atleast attempt to write it for you). I also like that this encourages you to write comments. So for example, if you weren't sure how to write a switch statement or a React Functional Component, it will help you write that. Really just replacing the benefits of Stackoverflow.

Here in this next example, I ask it via a comment to create a function that adds two numbers together. The default suggestion actually wasn't what I was looking for, it was correct but in comment form. I could've easily accepted that but had to erase the comment for that line, but there's actually a way to see more suggestions (it'll show you what it thinks is the best suggestion, but it may not always be what you want). At any point you can pretty Ctrl + Enter and it'll pop open a new window with all of the options where then you can "Accept" a solution.

Github Copilot Advanced Example

I just wonder about two things with these capabilities. First off will the suggestions improve over time (I'll do a follow up post in about a month with updated thoughts). And will those improvements occur for me only or for everyone. I think different developers have different preferences, styles, etc. and I would like to see an element to this that allows it to adapt to my style over time. The other concern I have, will the suggestions it provides, will they always be the best way to implement something? I think that determination is still something that's left to the developer. That's where AI can't help here, and real intelligence to make that determination is needed. I don't think copilot will ever write an entire application, but I think it'll be a vital tool in the toolbox of a developer, similar to how stackoverflow and intellisense are vital tools for the developer today.

Also I only played around with Typescript and Javascript, there is an extension also for Visual Studio that I'll install before my next writing, and it should also be good at assisting with C# code as well. I've never coded Python before, and I think this is where Github Copilot will provide the best assistance, working with syntax I'm not familiar with, I can use Copilot to help me learn Python faster. Basically, if I'm unaware of the correct syntax of the language, I can essentially ask it via comments, Create a Switch statement between 5 options or something like that, and it should output Python (or other languages that it currently supports) that can really help me learn the syntax faster, because I can now get help from within the IDE. Makes you wonder why they never added code searching from within the IDE, not to find stuff in your code, but to find snippets quickly. That's what Github Copilot reminds me of the most.

Conclusion

So to follow up, does this new tool replace developers? No, in fact I think it'll speed up efficiency and potentially quality. Also will help developers with new language learning. I don't think you'll need to google as much stuff, because that's essentially what it's doing for you, you instruct it with what you want to write, just like you would in a google search query, and it'll return the best guess, using Open AI technology to do so. The product is currently in Tech Preview, if you would like to play with it as well, check out Github Copilot and signup. I received my invite to the program via e-mail in a week or two, so you shouldn't have to wait long.

General

Home
About

Stay up to date


© 2024 All rights reserved.