Today's Question:  What does your personal desk look like?        GIVE A SHOUT

First impression of Github Copilot

  sonic0002        2021-08-13 22:45:31       2,056        0    

It has been some time since I heard about the new generation of AI powered coding assistant -- Github Copilot. Don't get chance to experience it until obtained the tech preview access recently. So this post will document some first impression while using it.

For now, this tool is only supported in VSCode and it can support various different programming languages. To enable it, just need to search and install the Github Copilot extension within VSCode. Once that is enabled, you will find that whenever you type something in your editor, there might be some suggestion with grey text showing up.

And if you feel the code suggested is what you want, you can just press Tab to ask it auto-complete for you. This is pretty convenient. It looks like auto-complete in this sense, but with context awareness.

According to its official documentation, it is most useful when trying to write some common or general functions like algorithms and data structures and for code snippet but not the whole project. 

Let's take a couple of examples. In Go there is no generic support and there is no support for max() for integers from standard math package, every time if ones needs such function, it needs to be written by the developer manually. Let's see whether Github Copilot can help with it.

After typing func max(, the suggestions show up like below:

From its content, this is exactly what we need and we can just press Tab key and it will add this piece of code for us. Nice.

Now let's see some more complicated example, let's implement the quicksort algorithm in Go. We just create a comment first with below content and it will automatically know what we want to do and try to suggest the function signature.

Thereafter it would try to suggest the whole implementation as well and you can just review it and use it if feeling ok.

This is good and it helps us to save much time on typing ourselves. And it's much smarter than other similar tools existing.

If something becomes more complicate or ambiguous, then what it suggested may become funny or less useful. For example, OAuth is currently being used frequently for obtaining access to other user's resource from another service so that the user no need to register everywhere to share their information. If typing below comment, the suggestions provided are less useful as the expectation would be how the OAuth logic works(like using client id, client secret to obtain access token), what it suggests is just a boilerplate.

Some points to be noted when using it:

  1. This tool is only an assistant, it can suggest code to you, but you are the one to make the decision whether accept it or not. 
  2. The code suggested by it may not be correct or not optimized per your need, so you still need to pay attention to the logic carefully before accepting it
  3. The code it suggests is from the open network, it means the tool itself doesn't create code by itself. It just scanned all the available code snippets in the open source community and analyzed them. 
  4. The tool is good at suggesting code snippet but not the whole project solution, if you need that, please stay away from it.
  5. The tool will become more powerful with more usage and more code snippet being analyzed by it
  6. Don't addict to it as you may lose the capability to write code autonomous without it one day just like some may not be able to write code comfortable without Stackoverflow.

Overall the experience so far is convincing and it serves the purpose well for general work. Will have more comments about it when using it for longer time. Stay tuned.

GITHUB COPILOT  FIRST IMPRESSION 

Share on Facebook  Share on Twitter  Share on Weibo  Share on Reddit 

  RELATED


  0 COMMENT


No comment for this article.