The latest “avalanche” of AI-powered tools has quickly overtaken the world.
For example, AI models like DALL-E Mini can generate a funny (and usually uncanny) set of images from any prompt, often to the detriment of human faces and the mechanics of human hands (for some reason, DALL-E Mini can’t draw hands).
You can check some of these on Twitter or Google at your leisure and at your peril.
However, it’s not all fun and games.
Recently, there has been a controversy involving an artist (a human one), an AI tool, a competition, and a prize. Apparently, a game designer named James Allen, won first prize in one of the subcategories at the Colorado State Fair Fine Arts Competition.
What’s wrong with that?
The thing is, James’ entry (dubbed Théâtre D’opéra Spatial) was generated by an AI. The tool is called Midjourney, and, just like DALL-E Mini (or the full version DALLE), it can generate high-quality images using an input of strings called prompts.
He got $300 bucks out of it, leaving none the wiser.
Now people are having a heated debate over James’ deception, which could help shape how we think about these things in the future, if at all.
This inevitably leads me to the main focus of this article: GitHub Copilot.
What is it? Is it viable to use? What is the best way to use it?
Below I’ll try to answer some of these questions and more.
What is GitHub Copilot?
GitHub Copilot is an AI programming model that helps developers write code. It uses the OpenAI Codex model (created by OpenAI) to suggest relevant code, offer entire functions from scratch, and even provide programmers with complete algorithms in real time. .
An important thing to note is that Copilot requires a subscription to use. The subscription model checks at $10/month or $100/year, with the first 60 days of use being completely free.
Additionally, GitHub Copilot is free for verified students and contributors to notable open-source projects on GitHub.
But is the price tag worth the goods?
The answer is yes. We’ll soon get to why this is the case.
How does GitHub Copilot work?
In theory, Copilot is a sophisticated AI tool that can analyze your code, offer suggestions, or introduce code corrections. In reality, it works a little bit differently.
First, Copilot is familiar with most popular programming languages, frameworks, and APIs.
Here’s where it gets interesting.
You can describe the desirable task, outcome, or suggestion in the comments of your favorite tool, and Copilot can come up with what it thinks are the proper lines of code.
Second, you can simply infer your intentions with incomplete prompts, and let Copilot do the code generation according to those same prompts.
However, the tricky thing is that the generated code doesn’t always fully reflect the initial prompt. This is understandable, since the AI can’t read into your intentions more than what is written (as a prompt) in Copilot. As a result, this may lead to Copilot generating unwanted bugs, code omissions, or code additions that you don’t want to have in your finished program.
For example, if you want to create, sort, or otherwise work with a list of items, you can specify the problem, and Copilot will write the code. To narrow it down even further (create a more specialized version of the same algorithm), you have the option to write the name of the algorithm as well.
One of the directions you can take the prompts is to suggest Copilot to use the concepts of bubble sort or selection sort in the code.
GitHub Copilot benefits
Copilot is excellent at writing boilerplate code. Boilerplate code is a software development term that refers to repetitive code that can be made much simpler (i.e., can be further optimized).
On the positive side, boilerplate code can be reused where needed, meaning it can be copied and pasted in multiple instances of the same source code, thus saving development time over the long run.
Additionally, Copilot also comes in handy when you need to start with a given project, but don’t exactly know how to start. It helps you set the wheels in motion, sort of speaking.
Finally, Copilot is relatively easy to use. It’s not overbearingly obnoxious and doesn’t offer suggestions in every step of the way, or helping out sparingly. This is better than Copilot trying to offer suggestions for every single line of code.
GitHub Copilot setbacks
Despite all of the positives, Copilot really struggles building more complex solutions by itself. If it doesn’t have the help of a human developer (to correct for mistakes), the code it generates can often become jumbled and borderline unusable.
For example, Copilot has difficulties handling multiple files from a single codebase. From what it looks like, Copilot can’t understand imports across files, as it often messes up both the data types and names alike (it seems like it only analyzes the files that are currently focused instead of analyzing the entire codebase, which is an inefficient way of solving problems in software development).
Additionally, Copilot sometimes doesn’t understand the context of your prompt and suggests code snippets outside of your real intentions. Other times, it can suggest valid source code, but the code itself is full of bugs and other errors.
Because of this fact, you should always revise Copilot’s generated code for unwelcome side effects.
Finally, Copilot is limited only to code suggestions and can’t work outside the confines of its creator’s creation (OpenAI). Despite what some would make you believe, Copilot can not tell jokes (programming-related or otherwise).
To summarize, GitHub Copilot can’t always pick the correct algorithm for the given situation. Also, it might often end up mixing up the data structures and data types (if they’re not defined in the language).
In other words, if the algorithm is not popular enough, it’s not advisable to rely on Copilot to come up with algorithms specific to your query.
As it currently stands, Copilot is well-worth the price of admission ($10 a month, $100 a year, or free for students and prolific open-source project contributors).
However, note that Copilot can’t replace a programmer’s job by itself; it still needs human input and an extended amount of editing to produce viable code.
After all, you are the captain of the ship, and in a way, GitHub Copilot is the captain’s, ahem, copilot.