After experiencing Copilot for some time, let’s talk about how it feels to use it.
What is Copilot?
Copilot is github’s AI-based programming aid that, in plain English, writes code for you.
So when it was born, many articles wrote: programmers to be laid off, programmer development tools beat programmers. Is that really the case? Let’s take a look at what it offers:
- Auto-complete code based on the code that was written and this is the main feature, auto-complete code based on the code that the developer wrote
- If a developer writes a comment first, Copilot automatically generates code based on the semantics of the comment
- If a developer writes a login() method and writes test below, the test_login() test will be automatically completed
The actual use
Looking at the main features above, I feel extremely powerful indeed. No more words, just try it.
Apply for to use
Because Copilot is still in beta, you must apply to use it. This is the address of application. After passing the application, you will be informed by email. Copilot currently supports the following three ides, corresponding to the warehouse address:
- Visual Studio Code
- JetBrains
- Neovim
Note that after the installation, you will be required to log in using github account, but students who have not passed the application are temporarily unable to use, so you must apply before using.
A preliminary study
Because the author is Android development, here with IDEA/AndroidStudio IDE, the actual use of the Java language example, to illustrate the actual use.
Code hinting
When you write a TAG, it will automatically prompt you, and the gray part is the code for the prompt:
Comment autoprompt
The first line is the comment I wrote, and the second line is the code for the prompt:
In addition to that, if the developer writes a comment, either in Chinese or English, it will automatically prompt you, so it will complete not only the code, but also the comments and so on. There are too many examples to mention here. In general, the experience is good. If the developer feels that the prompt is wrong, he can use the shortcut key to switch different prompt. Moreover, the prompt is not invariable, and as the usage increases, different suggestions will be given according to the developer’s usage habits.
Other languages
Copilot is currently good at languages that include Python, JavaScript, TypeScript, Ruby, and Go, in addition to Java. What about other languages that Copilot isn’t good at?
Kotlin
Kotlin automatically generates code:
Dart
Overall, Copilot’s hints are just as good in other languages and should be used with confidence.
The principle of
Copilot is so powerful, so how does it work? The official explanation: OpenAI Codex is trained in open source and natural languages, so it understands programming and human languages. The GitHub Copilot editor extension sends your comments and code to the GitHub Copilot service, which then uses OpenAI Codex to compose and suggest individual lines and entire functions.
To put it bluntly, it is to send snippets of code written by developers to the server, and then make best suggestions based on the source code that is publicly available on Github, and then return them to the developers. At the heart of the principle is the AI, and the training data provided by the massive source code on Github.
Safe hidden trouble
As mentioned above, Copilot will send your code snippet to its server. Is that a security risk? Let’s take a look at its claims:
Individual snippets of developer code are not shared with other users
Docs.github.com/en/github/c…
Stored code snippets are encrypted, including your URL, database address, account password, and more:
Docs.github.com/en/github/c…
Data access is strictly restricted to the following members:
- Access by designated GitHub people (employees and contractors) who work on the GitHub Copilot team or GitHub Platform Health team
- Microsoft personnel (employees and contractors) and/or the GitHub Copilot team working on or with Azure, as well
- OpenAI employees working on GitHub Copilot
Docs.github.com/en/github/c…
Overall, data security is guaranteed. Don’t use it if you are working in a sensitive position or on projects that require less confidentiality, and it is best to align this with the developer’s company policy.
The last
Copilot gives me the strongest feeling during the experience is that it can intelligently help me with some template sample code, and these template sample code is not the normal IDE prompt. I would like to call it the strongest code hint tool, it can not replace developers to write code, but a tool to help developers assist programming.
Copilot is also meant to be a co-pilot, as its description says:
You’re the pilot
With GitHub Copilot, you’re always in charge.
Copy the code