使用Copilot的编程经验

195 阅读4分钟

Copilot是由GitHub提供的人工智能编程助手。在我撰写此博客时,Copilot的价格为每月10美元或每年100美元,适用于个人开发者,企业用户则为每月每用户19美元。

总体而言,使用Copilot的经验绝对是积极的,尽管它的一部分知识需要进行重大更新。

今天我想分享一下我对这个编码助手的评价。在过去的几个月里,Copilot帮助我完成了三件事,并提高了我的工作效率。

在深入讨论之前,我想分享一下我的技术栈,因为我不确定我的范围之外的情况。Node.js、TypeScript以及一些前端框架是我日常工作中使用的技术栈,偶尔为了好玩而涉足Rust。我大部分时间都是独自工作。

Copilot在几个方面表现得非常出色。

首先,在开发过程中生成测试数据。只要您给变量起一个好名字或提供一个TypeScript定义,它就可以写出相当不错的虚假数据。在我开发前端组件时,这个功能为我节省了很多时间。

Copilot的第二个优势是它能够编写样板级别的代码。例如,当您尝试编写一个名为releaseOnHoldBooks的函数时,Copilot很可能会假设您想编写一个带有filtermap的代码块,然后根据这个假设生成代码。

Copilot的另一个优势是注释。我感觉Copilot只需要我输入一些单词和一个[Tab]键,就知道我打算在注释中解释什么。

当然,我们不要忘记聊天功能。当我无法指出模棱两可的错误消息的问题时,Copilot通常可以帮助我提供一些建议。

那么,有什么缺点呢?

正如我提到的,Copilot确实需要对其知识库进行重大更新。如果您的框架是Angular15+,Copilot可能无法提供太多有价值的建议,因为当它们做出切割时,Angular仍然是14,但在那之后发生了一些重大变化。

另一件事是它对文件系统的限制。如果您在多个文件中努力查找问题,Copilot甚至可能会使情况变得更糟。因为它每次只能查看一个文件,而在谈话进行一段时间后,Copilot将忘记先前内容的至少一部分。

因此,我想说Copilot确实值得您的花费,尤其是如果您周围没有人可以帮助您。但它不能替代您编写代码。

Copilot is an artificial intelligence programming assistance provided by Github. At the time I write this blog, copilot is 10permonthor10 per month or 100 a year for individual developers and $19 per user per month for business.

The overall experience with copilot is definitely positive, despite the fact that a part of its knowledge needs a major update.

Today I would like to share my review about this coding assistance. In the past a few months, Copilot has been assisted me with three things and elevated my work efficiency.

Before we dive in, I would like to share my tech stack because I am not sure the situation out of my reach. Node.js , typescript, and some front-end frameworks are the tech stacks I work with in my daily work, and occasionally got Rust on the side just for fun. I have to work independently most of the time.

There are a few things that Copilot is very good at.

First, composing fake data in the development process. It can write pretty decent fake data as long as you give your variable a good name or pride a typescript definition. This feature saves me much time when I develop frontend components.

Second advantage of copilot is its capability of writing boilerplate level code. For instance when you try to write a function called releaseOnHoldBooks, copilot is likely to assume that you want to write a code block with filter and map, and then produces code based on that assumption.

Another strength of Copilot is comments. I feel like the copilot just knows what I intend to address in the comments, all I need to do is a few words and a [Tab] key.

Of course, let us not to forget the chat feature. This is particularly useful when I cannot point out what is wrong with a ambiguous error message. Copilot can usually help me out with some recommendations.

What about the cons?

Like I mentioned, Copilot really need some major updates of its knowledge base. If your framework is Angular15+, Copilot could not provide much valuable suggestions, because when they made the cut, Angular was still 14, but some brake changes happened after that.

The other thing is its limits on file system. If you struggle to find a problem across several files, Copilot could even make it worse. Because it can only take a look at a file each time, and after a while into the conversation, Copilot will forget at least some part of previous content.

So, I would say Copilot does worth your money, especially if you have no one around to help you. But it cannot write code instead of you.

The Chinese version is translated by ChatGPT