I believe that all migrant workers will encounter many problems when writing code. These problems may be something they never know, something they know but are not familiar with, or something they know but forget.
Encountered the above problems, compared with most people’s first idea is: Google and Baidu!
For example, I want to search how to use the API provided by twitter to get some interesting tweets to develop my application.
Further, the second idea may be to check the documents.
For example, learn how to write a simple component through svelte’s documentation.
However, some documents are often lengthy and do not provide search. It will be difficult to simply find the usage of an API; Better documents may provide more convenient search functions, which can more or less reduce the time to solve problems.
For example, Vue’s documents provide convenient search functions.
We have been using the above methods all the time, but the problem is that we need to switch frequently and search back and forth. Ordinary people may need to focus on thinking when writing code. If we frequently switch between search engine pages, document pages and code editors, our thinking will be interrupted.
The above scene is familiar, isn’t it? Is it a small desktop with windows flying all over the sky.
Based on the above pain points, GitHub, the world’s largest gay dating website, released GitHub copilot!A new AI code assistant, when writing code or writing comment description code in the editor, automatically generates tips for you to write code next, so that you don’t need to search and check documents. All operations are completed in the editor!
Let’s start with an intuitive example to see how powerful GitHub pilot is.
A comment is written in the above code to describe the need to write a judgment function, use the web service to obtain a piece of text, judge whether the emotion of the text is positive or negative, then introduce the fetch function to grab the content of this article, write the function name, and give the types of input and return values, Then suddenly GitHub copilot generated the code that might be written next! Amazing！
You can see that the generated code is not random and illogical. It uses fetch to grab the corresponding links, and then uses await to process asynchronous requests. After getting the results, it judges whether the feelings of the text are positive through the contents of the results. What’s better, it can also give the links to grab by itself. It doesn’t need to search blindly and is efficient!
If the above code needs to be written directly by an engineer, you may first understand the usage of fetch, then copy the usage, then go to Baidu and Google to find those API services that can be used, and then understand the return body length of the API service, so as to write the above code.
Good guy, CV engineers are laid off directly, and product managers can write code.
In addition to the above automatic code generation based on comments, GitHub copilot also has many interesting functions. Next, let’s learn about them one by one.
When you are writing some repetitive code, GitHub copilot will automatically fill in the code you may want to write next:
Let’s have some tests ♂️
A piece of robust code needs perfect tests, but writing unit tests is sometimes tedious, but GitHub pilot can bring you some different experiences. Just import your unit test package, and then it will generate corresponding test code for the code you write:
Draw a picture?
As long as you import the corresponding package and give a reasonable name, GitHub pilot can write the code you may want to write next, such as importing D3 and then writing a
drawScatterplotVariable, the following code can be generated:
Besides JS and python, what else?
Thanks to GitHub’s largest code base in the world, which contains a variety of the most comprehensive and fresh code, GitHub pilot can support the generation of various languages, such as JS, python, ruby, typescript, go, etc.
Become a tab Engineer?
As we know above, GitHub pilot can generate code according to comments, automatically fill in duplicate code, and generate tests for your code. It basically solves the problems that you may need to open multiple windows when writing code. These features reduce the threshold for newcomers to learn programming, understand a library, and want to learn new languages and libraries.
However, sometimes the code generated by GitHub copilot for the first time is not what you want. At this time, it also provides options for you. You can
option+](yes on Windows)
option+[Select the previous,
TabTo accept the code recommended by GitHub pilot.
So, CV engineers have been transferred to tab engineers?
There are only tabs from this keyboard.
Can I use it?
The answer is yes, but not immediately.
Because GitHub pilot is supported by very expensive hardware devices, it consumes a lot of energy. So it is only open to a small number of people to understand how users use it and explore the mode of large-scale business.
However, according to the experience of me and my colleagues around me, it can be used as long as I apply, but there is still a period of time from application to approval, which takes about 1-2 days.
How to apply?
visithttps://copilot.github.com/, click Register:
Then associate your GitHub account and apply. Finally, you will receive such a prompt:
The above prompt has been added to the waiting list. You can use it after waiting for the formal email notification.
If you have passed the application, you need to download the corresponding plug-ins in the editor. At present, GitHub pilot only supports vscode, JetBrains editor and neovim, and more editors will be supported later. Therefore, if you want to experience the function, you need to download the corresponding editor. Let’s take vscode as an example, open the editor, search GitHub copilot in the extension, or visithttps://marketplace.visualstu…Link Download:
After installation, when you create a new file or open a file for editing, GitHub copilot will be prompted in the lower right corner of the editor to request GitHub login authorization:
You just need to click login, and then log in to the GitHub authorization website with the GitHub account you just applied for GitHub pilot to authorize.
All right, it’s done! Next, you can start writing code in a language you are familiar with, and then enjoy GitHub copilot’s fantastic code tips! Secretly tell you that my colleagues around me said they would use it.
The principle behind
I believe many small partners will be curious to see here. How does GitHub copilot achieve such intelligence?
In fact, based on the Codex AI model provided by openai, GitHub pilot uses a lot of open source code and natural language on the Internet for training, so that it can be more intelligent than other code assistants, understand the context of code and natural language (such as comments) from the files you are currently editing, and then learn according to the training knowledge, Give some answers (codes) that it thinks are most reasonable.
GitHub copilot gives the general process of code prompt as follows:
A simple analysis is:
- First, use the openai model Codex to extract the public network code and Internet text as the corpus for training
- Then use GitHub pilot as the service provider layer
- Then, the user downloads the plug-in to the editor, activates the GitHub copilot service when writing code, sends the code context to the GitHub copilot service, and then obtains code suggestions
- Users can choose the code options they want, or modify the generated code to meet their needs, and these selection and modification records will also be sent to GitHub pilot service to help the AI model become more intelligent
What you need to pay attention to
Although GitHub copilot is very powerful, there are some problems to pay attention to when using it ♀️。
Will GitHub pilot replace programmers?
No, GitHub pilot’s main function is to assist programmers in coding, reduce some redundant manual labor, focus on solving interesting problems, and make programmers more productive.
Does the code generated by GitHub pilot have intellectual property rights?
No, you can use GitHub copilot as a compiler or something lower. It provides you with suggestions and helps you write better code. The final ownership of the code belongs to you.
Can I use the code generated by GitHub copilot in a production environment?
Yes, but it is recommended that you treat these codes as if they were written by you, and conduct strict testing and code review, because the corpus used to train AI models may be outdated and problematic. Although GitHub pilot will constantly iterate them and set some rules to ensure that problematic and outdated codes will not be generated, However, it is difficult to fully guarantee that these rules can cover all situations.
Will GitHub pilot get my personal data? Invade my privacy?
No, GitHub copilot only analyzes the context in which you edit the file content, and sets strict filtering rules for private information, such as replacing private mailbox data with general mailbox format[email protected]And so on, without analyzing other data on your computer. At the same time, when recommending the generated code to you, it will also strictly filter the code.
At the same time, the uploaded content will only be saved to GitHub copilot’s database and will not be opened to others.
The above is about GitHub copilot, the GitHub King fried product. What do you think of this product? Welcome to my official account.Programmer bus“Join the group!
/Thank you for your support/
The above is all the content of this sharing. I hope it will help you^_^
If you like, don’t forget to share, like and collect~
Welcome to the official account.Programmer bus, three brothers from byte, shrimp skin and China Merchants Bank share programming experience, technical dry goods and career planning to help you avoid detours into big factories.