Happy days with Copilot

Happy days with Copilot

Hi everyone, welcome to my tech kitchen. In this episode, let's cook some examples of how GitHub Copilot can make your day, as it did for me many times. Let us cook.

Fix my code

While trying out some example code to implement a Kafka consumer in Python, I ran into the following:

Please allow me to draw your attention to the "No quick fixes" part of the screenshot:

Now, the above screenshot is taken with Copilot turned off.

So, here comes the first example of how turning on Copilot made my day, as it will yours:

So, you see...With Copilot.... Got Fix...

Now, let's see how Copilot fixes this. Clicking Quick Fix... I see this:

Here's the fix that Copilot proposes:

All I had to do was Accept.

What syntax?

The next thing I really like about Copilot is how it makes syntaxes a lot easier to deal with. With Copilot, not only do you not have to remember precise syntaxes, you don't have to even type out tedious syntaxes... such as Markdown tables:

In the above, I type the left side, Copilot generates the right syntax on the right side. Look at how much time I save not having to deal with that table syntax.

Complete for me

This is pretty standard stuff, but a little more next level and it happens all the time. For example, while typing this out:

So, it's not just code, which is nice if you think about it. Anyway, I think what many folks that are doing Copilot impact assessments do is measure "suggestion acceptance" rates, and it is very high for me, especially for work stuffs.

Know better than me

It really does help that Copilot is trained on a large knowledge base. So, obviously, it knows a lot more things than me. In the Ansible YAML below, I wanted to specify that the automation should use the main branch, but I don't know the parameter to use, again Copilot made my day:

Notice that the parameter name "version" isn't obvious at all, I'll imagine the obvious parameter for this to be "branch", but yet, Copilot knows this...

Generate documentation

This is one of the most common rants out there, i.e. documenting code, but it is indeed also one of the aspects in which Copilot, being LLM, really shines over symbolic methods. The documentation generated is top class, and here you go, better than what I could had done...

Generate tests

I am not one of those programmers that likes to express themselves through tests first, i.e. "I am going to start thinking about what I am about to program by thinking about what the right output should be and what could go wrong"... I prefer to dive straight into the solution.

Nevertheless, Copilot can write tests for me before I start writing any code. Here, I use Copilot Chat:

And of course, Copilot can write tests for functions and other structures that I'd already implemented too.

Generate the actual code

In the previous screenshot, Copilot actually generated the implementation along with the tests I'd asked for, talk about value add!

Seriously though, code generation is a walk in the park for Copilot. It is so easy to use that I had started to use natural language by default.

Here, I tell Copilot in natural language to create a Python module:

Here, I tell Copilot in natural language to use the module that it just created to do more things:

And so on, so forth...

Dawn of a new age

At this point, I hope you can see how different your days can be with Copilot. If you know how to program, think about how much easier it is with Copilot, especially with new things you're not familiar with. If you don't know how to program, does it actually look that hard now?

Happy days...





James Croyle

Web3 Builder | C Suite | Strategic Partnerships | Explosive Growth Leader | ex Microsoft, Check Point, IBM

1 年

I'd like to time travel back to 2001 when I was embroiled in professional services for an ISP. The amount of code we wrote, rewrote, and fixed bugs in was too d@%* hight! Those were simpler times back then.

回复

要查看或添加评论,请登录

Vito Chin的更多文章

社区洞察

其他会员也浏览了