Introduction to Copilot
Copilot is a programming tool developed jointly by GitHub and OpenAI. It is an AI-powered programming assistant. With the help of GitHub's extensive code library and contributions from the global open-source community, combined with OpenAI's expertise in natural language processing and machine learning, Copilot has become a powerful assistant for developers, providing new features such as code suggestions and code generation.
In a previous article, I introduced the usage of Copilot by SenseTime. Today, let's take a look at Copilot-Tongyi Lingma developed by Alibaba. And the best part is, it's free!
According to the introduction on the Alibaba Cloud official website, we can roughly understand the following key factors:
- TONGYI Lingma provides real-time continuation at the line/function level, natural language code generation, unit test generation, code comment generation, code explanation, intelligent Q&A for development, and exception troubleshooting capabilities.
- Compatible with mainstream IDEs such as Visual Studio Code and JetBrains IDEs.
- Supports mainstream programming languages such as Java, Python, Go, C/C++, JavaScript, TypeScript, PHP, Ruby, Rust, and Scala.
Installation
Without further ado, let's start the installation. I will demonstrate using VSCode. Simply search for "TONGYI Lingma" and it will be the first result.
After installation, you will be prompted to log in to your Alibaba Cloud account. Once logged in, you can start using it. The sidebar provides some proactive features such as code explanation, test generation, comment generation, and code optimization.
Now, let's get started with the testing!
Real-life Experience
Coincidentally, I was working on the frontend code for an AI website and was having some trouble. So, I decided to give Copilot a try.
As a backend coder for many years, I only recently started writing frontend code for AI websites. So, please don't judge me too harshly, experts. 🙏🙏🙏
Here is the original design of the website module I wanted to add:
I wanted to add a module called "Drawing Task" below the website. Currently, the interface waits synchronously for the backend to complete the drawing, but the user experience is not good. It takes about ten seconds to wait, and there is also a possibility of errors. So, I wanted to make it an asynchronous task, displaying the currently running task in the "Drawing Task" section and updating the status of the task list through periodic polling.
So, I created a new file and started describing the task. Copilot quickly provided the result, and you can quickly copy the code to the editor by clicking the small button on the right.
With the help of Copilot and my modifications, my implementation was completed in about 10 minutes:
From the results, it basically met my expectations. As for the color scheme, I'll figure it out later. 😭
During the usage, I deeply experienced what it means to "program in natural language". For example:
And more:
And so on:
Based on the code examples provided by Copilot, there is a high probability of getting the code I want, and this probability increases as the overall code comment coverage increases. And it's really fast! (Faster than the previously mentioned SenseTime)
I also tested Copilot's code explanation feature. At that time, the website had a simple carousel that would enlarge the next image every 3 seconds in a loop. Here is the original design:
I clicked "Explain Code" directly in the sidebar to see if it could understand:
It roughly understood what I wanted to achieve. Interestingly, there are two buttons below the answer: "In High Level" and "In Detail". As the names suggest, they provide a more abstract and more detailed explanation, respectively. Let's try them out.
In High Level:
In Detail:
In addition, the chat box on the left can be used to ask questions, similar to a simplified version of ChatGPT. Well, except for the time not matching, everything else is fine. It can be a good way to pass the time.
Summary
The above is my actual testing process. Here is a brief summary:
It can improve productivity by about 30% if used well.
Alibaba's Copilot is helpful for programmers. At least for me, there is not much difference compared to GitHub Copilot. If you are a beginner, it is like having a supervisor who can monitor and help you at any time. If you are experienced, it is like having a peer who can identify some issues. If you are highly skilled and have a deep understanding of prompts and strong modular thinking, it can greatly improve your work efficiency!
I did not test the unit test generation feature because it is a personal project and there is no need for unit tests. But according to comments from other forums, it works well.
AI applications in the future will become more and more user-friendly and widely used. Currently, ByteDance, Alibaba, and Meituan are all exploring the use of AI in engineering fields, including but not limited to Copilot, unit test generation, and code review. Everyone should understand and learn about them.
Lastly, Alibaba's Copilot is free, so take advantage of it!
If this article has provided you with some insights, please consider liking and bookmarking it. Next time, I will introduce another star project with over 10,000 stars, GPT-pilot. What can it do? It can directly build project structures based on your requirements and continuously improve them under your guidance. In short, you arrange, and it writes the code.
Thank you all.
Author: Qingyu Bailu
Link: https://juejin.cn/post/7317820788546961427
Source: Xitu Juejin
Copyright belongs to the author. For commercial reproduction, please contact the author for authorization. For non-commercial reproduction, please indicate the source.