Code autocompletion tools have existed for a long time. We see them in IntelliSense, IDEs, and as extensions for most text editors. These tools have become more and more intuitive and useful for software developers. Now with the arrival of GitHub copilot, a code autocompletion tool that uses artificial intelligence (not the first of its kind), we could take our work to the next level of productivity. Should we pay more attention to this type of tool?
Surely we have heard of IntelliSense or if not, we have surely used it without knowing it. This tool was introduced as a code autocomplete feature by Microsoft in its Visual Studio IDE in 1996, initially for the Visual Basic language. Although it seems that it was introduced a long time ago, it was not the forerunner in code autocompletion. A program called SPELL, published by Engineer Ralph Gorin in 1971, was the first attempt to find matches in a list of words given the first letters. Tiis tool was used with the SAIL language.
Starting with the introduction of IntelliSense as an autocompletion tool, as time went by, other IDEs such as Eclipse or Netbeans also integrated code autocompletion tools into their environments. However, Intellisense became another word for autocompletion.
This era of private IDEs was followed by the amalgam of open-source text editors that have become so popular today, a demand linked to the fact that developers did not want such robust, heavy, and full of features that they were not going to use. Of course, code autocompletion was a tool that even the most minimalist IDEs offer the possibility of installing extensions for this task or some have it included for most programming languages.
Extensions now offer specific IntelliSense for all kinds of languages. This applies to most modern IDEs. We are talking about a tool that helps us call functions from the language's own libraries or from third parties; call variables, objects, functions, or classes that we are working on in our own code; and suggest syntax corrections before our compiler highlights them. Sounds pretty good so far, so what else could these autocomplete tools offer us?
Well, the next step has been to provide these tools with the power of AI, and of course, this has been possible thanks to the boom that open source development has had and the large number of developers who make contributions to the community in the last decade -- through pages that offer the service of repository storage and version control, GitHub, GitLab, or Bitbucket.
All this large amount of code that is online has served to feed the deep learning processes that are carried out to train AI. Particularly we are talking about the field of NLP (Natural Language Processing), and the Transformer model which has promoted the state of the art in this field. This is how OpenAI developed GPT-2, which is used by the TabNine tool to make a more intelligent code autocompletion thanks to the more than 2 million files found on Github and with which the model that uses the tool was trained. Thanks to this, TabNine offers us an autocomplete, not only of functions or classes but also of complete instructions and entire lines of code analyzing the context that exposes the rest of the code of the file and files in our draft.
Although TabNine, along with other similar tools such as Kite, has already been on the market since 2019, now GitHub or more properly Microsoft, one of the partners of the OpenAI project, has launched GitHub Copilot which uses the Codex model to analyze code, which is a direct descendant of GPT-3. It would be nice to clarify that GPT-3 was trained with 116 times more data than GPT-2, a huge difference.
GitHub Copilot is currently in beta, but it comes with the promise of creating complete blocks of code apart from comments in natural language, so just by writing in a comment “bring the last Facebook post from an account”, you would be suggesting a code block where you access through the official API in a fetch request together with the “account” parameter, and return the information that we request extracted in the same response block that you give us the request. Quite powerful, not free of errors, but with a complete structure of a function. We can now use our hands and make the arrangements that we consider necessary or search among the different suggestions that Copilot offers us to solve the problem.
Another of the great promises that it brings is to suggest unit tests. How many times have we not come across that after finishing writing the code of a new feature? We have to write the tests that cover all the new code that we generate, and this is generally one of the most tedious tasks in development, but with a tool that has the ability to understand the context of our project. Seeing that it is capable of inferring the test to be carried out from natural language would help to greatly reduce the technical debt that we generate in our work.
Last but not least is the autocompletion of repetitive code or boilerplate, which many times in our work we are faced with writing blocks of code that resemble others that are already in the project, but that needs slight changes that will be abstracted based on the context of what Copilot interprets from our project.
Of all that Copilot promises, what it delivers is less time searching for answers from the Internet because known good coding solutions are made available right in the editor. This is of great value to any project.
At this point, it is easy to see how a good developer can make use of the correct tools in order to improve the quality of the code he or she writes, and tools like GitHub Copilot will help junior developers who are just starting out in the world of development by showing them, directly in the editor, suggestions mined through thousands of open-source repositories, which will help strengthen their knowledge in ways that no teacher or course could supply due to the size of such competition.
On the other hand, for those of us who are more advanced developers, we can increase productivity in our day to day by reducing the time it takes us to write blocks of code that perform a specific task, write sometimes tedious unit tests, and write repetitive code, while of course always having the last word as to what we want part of our code to do.
In my opinion, it would be good if we began to use these types of tools because if we ignore them, we will be opening more and more of the productivity gap between those who know how to use these technologies and those who continue to write code in the old style.
We’d love to learn more about your project.
Engagements start at $75,000.