Not so long ago, artificial intelligence was the main antagonist of Sci-Fi movies. And today, it is all around us. Almost every product that comes out of the technology world seems to have some element of artificial intelligence. AI has a significant impact on our daily life, but have you ever wondered what AI is really capable of? A great example of a futuristic vision becoming reality is the GitHub Copilot.
This is the first part of a two-part article:
- Part I: Basics (you’re reading right now) – The minimum you need to know about GitHub Copilot,
- Part II: Technical – We will dive into technical details. I’ll show you some examples and Copilot’s limitations.
GitHub Copilot is super cool, but what the hell is it, anyway?
Copilot is a tool built into the code editor that is capable of writing code itself based on the code you’ve already written in your project. The only thing you need to do is type a function name or some comments and Copilot will automatically fill in the implementation. The tool processes the user’s input in the cloud and comes back with a snippet that you just accept, decline, or ask for further solution suggestions.
GitHub Copilot was introduced by GitHub aka Microsoft on 29 June 2021. The tool is powered by OpenAI GPT-3 which is a language-prediction model designed to generate human-like text. GPT‑3 is the most advanced autoregressive model created by mankind. The AI itself was trained on publicly available code from GitHub. Indeed, there is some serious money behind this solution. Microsoft and OpenAI, who were involved in the development of Copilot, have invested two billion dollars in this project. What we see now is a product of that investment.
Is Copilot really that good?
In practice, it’s doing surprisingly well. It’s not like most of those annoying code snippet packages. It’s actually not annoying at all! I often forget that I even have it running. It does not interfere much with your workflow. If you don’t like any of Copilot’s input, you can just ignore it and carry on. Despite my initial scepticism, in the end, I was amazed that this tool can be truly useful. It makes the biggest impression only after spending some time with it. It’s when you realize that generated suggestions are not just random answers from Stack Overflow. It’s using your project as a context. It follows your style and naming convention. It sees the variables you are using, the elements that already exist, and uses them in its proposals.
For example, If I create a variable and name it successMessage. Copilot will suggest appropriate content. Moreover, it will notice the pattern and will try to generate errorMessage without my input. Unfortunately, it won’t design app architecture or refactor your code.
One of the things I’ve noticed is that Copilot doesn’t seem to care much about abstraction and composition. Most of the time, Copilot’s suggestions are at least decent, but sometimes it feels like it’s choosing a random structure. On the other hand, we have algorithms. In my opinion, this is the field where GitHub’s extension shines especially. When it comes to logical statements, it rarely misses. Do you need to invert the binary tree? (If you do, accept my condolences) No problem. Just name a function in some descriptive way, and you’re done. It would probably take less than 2 seconds to generate implementation details.
Can GitHub Copilot be any threat to developers?
After hitting the programmer’s market, it has been widely discussed whether it is a big step toward the death of computer programming or just another autocomplete tool on steroids. Well, it still requires some serious knowledge to build software. Even with Copilot’s help, you need to know what you are doing, verify and understand generated code. It’s not possible (yet) for non-programmers to jump on Copilot and build whatever they want.
The tool is not perfect. It doesn’t always generate the correct code. There are a lot of bad practices and deprecated code out there. Even worse, Copilot can write security vulnerabilities, especially in memory unsafe languages. It isn’t 100% reliable yet. You absolutely need to review Copilot’s code. This is AI. AI needs to learn. It will get better with time, but we need to wait.
Copilot GitHub: Conclusion
From my point of view, it seems like developers are gonna be writing less and less code in the coming years, maybe a decade. Copilot is just one of many tools that improve and will keep improving our work. In fact, relying too much on tools like that might lead to unnecessary work or even serious problems. It is not even close to replacing programmers.
Nevertheless, in the end, the computer is simply better than humans in writing boilerplate code, algorithms and making calculations. Just let them do it and let’s focus more on the creative problems.
If you want to make peace with your enemy, you have to work with your enemy. Then he becomes your partner
– Nelson Mandela
Q:What is GitHub Copilot?
GitHub Copilot is a tool built into the code editor that is capable of writing code itself based on the code you’ve already written in your project. It uses OpenAI GPT-3, a language-prediction model, to generate human-like text and is trained on publicly available code from GitHub.
Q:How does GitHub Copilot work?
The user types a function name or some comments and Copilot will automatically fill in the implementation. The tool processes the user’s input in the cloud and comes back with a snippet that the user can accept, decline, or ask for further solution suggestions.
Q:Is GitHub Copilot really that good?
In practice, it’s doing surprisingly well. It does not interfere much with the user’s workflow and can be truly useful by following the user’s project style and naming convention, and using variables and elements that already exist in the project. However, it does not design app architecture or refactor code.