GitHub Copilot - a pair programming match made in heaven?
If you are in the tech space, you may have read about the splash AI is making when it comes to software development and data analytics. Just last year, we saw how it was possible for a user in PowerBI to build complex DAX queries using natural language, courtesy of the OpenAI GPT-3 model. And more recently, at Microsoft Build 2022, we saw the announcement of Express Design, a way of making low code application development even easier by converting images or Figma files into a working canvas PowerApp design.
Well, just earlier this week, GitHub Copilot also became generally available in what has been hailed as an AiPPaaS or AI Pair Programmer as a service, a term I obviously made up, but hey, it has a nice ring to it so let's stick with it. Copilot is only available, for now, to individual developers with a company option to be rolled out later this year. It is a paid service and subscriptions start at $10 USD per month or $100 USD per year. There is a 60 day free trial and it can also be free for verified students or maintainers of popular open source projects.
So firstly, what is Copilot and what is pair programming? Pair programming is the technique whereby two developers write code together, usually for the same component or module at the same time and on the same machine. The idea is that pair programming, when done right, can improve both communication and collaboration and therefore code quality. It can also be used as a mentoring technique for more junior developers. Copilot will therefore act as your pair programmer (hence the name), looking at your code and offering up suggestions, from single lines of code to entire functions. In short, it is pretty much IntelliSense on steroids.
Copilot is powered by Codex, another OpenAI model just like GPT-3 that has been trained on public or open source code and natural language. It is an extension that can be installed in your development environment that will send your codebase to the GitHub Copilot service along with context. Context refers to the comments within your code, other files within the same project/folder and even URLs. The OpenAI Codex will then synthesize the inputs and return you the top snippets of code that best matches what you are writing.
Privacy is obviously a contentious topic here and you, as the developer have several choices when it comes to how your code/data is collected and used. For example, you can choose whether to allow your code snippets to be retained by GitHub and shared with Microsoft and Open AI to better improve the service. You can also submit a request to delete all the data associated with your GitHub identity. Here is a link to the privacy section of Copilot FAQs. At the end of the day, it comes down to a risk assessment exercise as to whether you should leverage Copilot.
From my testing using Visual Studio Code and building a simple non prod ReactJS app, setup is extremely easy and all you need to do after installing the extension is to authorize GitHub if not done already.
领英推荐
As I typed, you can see Copilot getting to work and providing suggestions based on what I was typing. I was super impressed by the speed of the service. Suggestions usually only take 1-2 seconds to show up which is great as the last thing you want is lag on a service like this.
If you hit Ctrl+Enter, another window will open up and you can then browse through the top suggestions and accept the solution that best fits what you are developing. No doubt this feedback loop will also be used to further refine the Codex model.
At a developer, it is important to understand what the code you are borrowing / importing is doing. So whilst it is extremely easy and tempting to hit Tab to add a line of code here or there, care and discipline must be taken to understand exactly what the code is doing especially when importing entire functions. With this said, this service may not be entirely suitable to a junior developer who is trying to improve their programming as it can result in a dependence on the service and create bad habits.
For other developers, it is easy to forget the many variations of syntaxes especially when programming across different languages and libraries. Often times, Google is your best friend and I can see how Copilot would be quite useful here as you would no longer need to leave your IDE to look for reference material.
I will be interested to see if Copilot for companies will behave differently and have a different layer of controls when it is released later this year. For now, Copilot is available as an extension for many flavours of IDEs from Visual Studio, Visual Studio Code, JetBrains and Neovim so be sure to check it out.