What Is AI-Assisted Coding, and Should You Use It?

Should developers use AI to generate code? Here are the pros and cons of AI-assisted coding.

Christopher Tozzi, Technology analyst

December 16, 2022

5 Min Read
robot typing on a keyboard
Alamy

For years, the idea that you could automatically generate custom source code seemed like fiction. But it has become reality thanks to new services like GitHub Copilot and Tabnine, which provide AI-assisted code generation.

Solutions like these have shifted the question from "how can we use AI to generate code?" to "should we use AI to generate code?"

There's no clear answer, but there is plenty to say about the pros and cons of AI-assisted coding in today's development environment.

What Is AI-Assisted Coding?

AI-assisted coding is the use of machine learning models to generate code automatically. Most existing AI-assisted coding tools let developers describe in natural language what they want their code to do. Then, the tools automatically generate the code to do it, complete with custom variable names and the invocation of external modules or services, where necessary.

In the background, the tools are powered by algorithms that were trained using vast amounts of existing source code — which usually comes in the form of publicly available source code produced by open source projects. Based on these examples, the algorithms generate custom code on demand.

How New Is AI-Assisted Code Generation?

The idea of automatically generating source code for applications isn't especially new. Low-code and no-code development tools have been around for decades. And IDEs have long offered autocomplete features, which you could consider a simple form of automated code generation.

Related:Low-Code Developers Report Higher Levels of Job Satisfaction

What's different about AI-assisted code generation, however, is that, like low-code and no-code tools, it doesn't rely on prebuilt code modules to allow developers to construct applications without writing much (or any) code themselves. Instead, AI-assisted coding tools generate custom code entirely from scratch.

This means that, at least in theory, there's no limitation on what AI-assisted code generation tools can do. As long as the algorithms are good enough and the data they are trained on is comprehensive enough, AI-assisted coding tools could in principle write highly complex applications based only on natural-language descriptions of how those applications should work.

Although developers have long talked — usually half-jokingly — about the idea of using AI to write code, AI-assisted coding solutions have really only matured over the past couple of years. They represent perhaps the latest major innovation in the realm of software development.

Where to Find AI-Assisted Coding Tools

A variety of vendors now sell AI-assisted coding tools or services. Probably the most famous are GitHub Copilot (which is based on OpenAI Codex) and Microsoft Intellicode. Smaller companies, including Kite and Tabnine, also offer production-ready tools for AI-assisted code generation.

Related:Do Programmers Still Need to Have Linux Skills?

Open source tools exist in this domain, too, although — like many open source solutions in newly established domains — they tend to be rougher around the edges than the commercial alternatives. To date, the main open source AI-assisted coding tool is PolyCoder.

The Pros and Cons of AI-Powered Coding

AI-assisted code generation offers one main benefit: It saves developers time by allowing them to write code without actually having to write code.

You could also argue that AI-powered coding tools are helpful in situations where developers want to implement certain code but don't know how. I'm not convinced that that is the case currently, however, because AI-assisted coding tools aren't sophisticated enough — at least now — to be able to generate truly complex code. Plus, to get good results when using these tools, developers often have to be relatively specific about how they want their application to do something — so developers more or less need to know how they would write the code, even if they use AI-assisted tools to write it for them.

On the other hand, there are clear drawbacks to AI-assisted coding:

  • Low accuracy: Advanced AI-assisted coding solutions, like OpenAI Codex, generate accurate code only 37% of the time, according to their developers. That obviously falls far short of the performance necessary for programmers to let AI fully take the wheel (which, to be fair, is not what these solutions currently promise — there's a reason why Copilot is not named Autopilot).

  • Extensive code review: Developers have to accept (or reject) automatically generated code as they work. For some coders, the need to review code constantly could be distracting. They may be able to work more efficiently if they just write out all of their code manually.

  • Legal and ethical issues: One of the stickier issues involving AI-assisted coding tools is that, because the tools are trained using open source code, they essentially reproduce code that was written by another project. This raises legal and ethical questions, which have not yet been sorted out. If your AI-assisted coding tool produces code that closely resembles code in another GitHub repo, does it make you a plagiarizer or a license violator? We don't yet know, but we probably will gain perspective as people begin suing each other over these issues.

These challenges mean that AI-assisted coding tools may be handy for developers who want a fast way to generate relatively simple code, and who are willing to review — and, if necessary, tweak — it to ensure it's accurate. I also suspect that we'll see AI-assisted coding used more often by programmers working on proprietary projects whose source code won't be exposed to public scrutiny, and who therefore are less likely to get caught up in accusations that they've stolen other projects' code through their AI-powered code generators.

But time will tell. For now, AI-assisted coding represents a frontier that is still being conquered. It will probably take several more years before we know how good AI-assisted coding tools end up being, and whether they expose users to complicated legal or ethical challenges.

About the Author(s)

Christopher Tozzi

Technology analyst, Fixate.IO

Christopher Tozzi is a technology analyst with subject matter expertise in cloud computing, application development, open source software, virtualization, containers and more. He also lectures at a major university in the Albany, New York, area. His book, “For Fun and Profit: A History of the Free and Open Source Software Revolution,” was published by MIT Press.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like