AI coding assistants might speed up software development, but are they actually helping produce better code?

Software development team members discussing work in an office environment.
(Image credit: Getty Images)

The use of AI tools in software development has increased rapidly in recent years, enabling developers to write code faster and supercharge productivity. 

Tools such as GitHub Copilot, for example, use generative AI to generate potential code that developers can then add into their projects, saving them time and effort. 

These are used by millions of developers to generate billions of lines of code, and, according to their makers, can even make developers more productive and happier.

Research from GitHub last year found that developers can complete tasks 55% faster using an AI assistant while 75% of devs said they were more fulfilled.

However, recent research from GitClear examined 153 million changed lines of code written between January 2020 and December 2023 to see if it could spot any code quality differences as a result of the rise of AI coding assistants over that period.

It said it found “disconcerting trends for maintainability”.

In particular, it said that ‘code churn’ – which it defined as the percentage of lines of code that are reverted or updated less than two weeks after being completed – could double in 2024 compared to 2021.

GitClear said that while AI tools help to write code faster, that doesn’t account for the code that shouldn't be written in the first place.

AI coding tools speed up software development - but are we sacrificing quality?

“Writing bad code faster implies considerable pains for the subsequent code readers,” the report said. While AI assistants will offer suggestions for adding code, they won’t offer suggestions for updating, moving, or deleting code because of the limitation of the text-based environments where code authoring occurs, the report added.

Part of the problem, it said, is that code suggestion algorithms are incentivized to propose suggestions most likely to be accepted, while code maintainers are incentivized to minimize the amount of code that needs to be read.

This may explain the difference why junior developers are more likely to accept code suggestions.

“Experienced developers have the most informed understanding of how costly code will be to maintain over time. If they are more averse to using AI suggestions, it raises questions about the extra code that junior developers are now contributing, faster than ever,” the report said.

GitClear’s analysis of million lines of code found that while code churn was “relatively infrequent” when developers were writing all their own code, accounting for around 3-4% of code, this increased to 5.5% in 2023 - and the report suggests it could hit 7% this year.

“The more churn becomes commonplace, the greater the risk of mistakes being deployed to production,” the report noted.

The research also suggested that less code was being moved by developers, suggesting there was less code reuse.

As a code base grows, developers often rearrange existing code into new modules and files that can be reused in new features. That can be a smart move as the code has already been tested and worked on by more developers, so is more likely to include documentation.

However, GitClear said that combined with the growth in code labeled "copy/pasted," there is “little room to doubt” that the current implementation of AI assistants discourages code reuse.

“There is perhaps no greater scourge to long-term code maintainability than copy/pasted code,” the company warned.

Part of this may be down to developers’ own preferences. Because most developers prefer adding new features to interpreting potentially reusable code, copying and pasting code is a habit that often persists “long past its expiration date” the report said.

That can be especially on less experienced teams, or where there may be no code maintainer with the authority to remove the unnecessary code.

“Even when there are senior developers possessing such authority, the willpower cost of understanding code well enough to delete it is hard to overstate,” it said.

GitClear said one question for the future was at what rate development progress becomes inhibited by additional code. “The current uncertainty is ‘when is the accumulated copy/paste tech debt too great to ignore?’” it said.

AI tools are still in their infancy, and they're going to need time

However, the impact of generative AI on coding is far from settled. A smaller survey by software development company Akvelon said these tools can have a positive impact on code quality.

“Developers with a strong foundation of knowledge and experience in their respective domain can extract maximum value from GitHub Copilot,” the report stated. “Their expertise empowers them to dismiss unsuitable suggestions and optimize the utilization of the tool.”

It’s still very early days to work out what the impact on developers will be of these generative AI tools, and it’s likely their usage is going to evolve.

For example, according to a recent survey by JetBrains, although developers do use these tools to write code they are actually slightly more likely to ask these assistants for general information about coding.

In an ideal world, the developers said, they would be most likely to delegate writing documentation to an AI and least likely to delegate code writing. As such, how developers use these tools - and the impact on code - could look very different in a year or two.

Steve Ranger

Steve Ranger is an award-winning reporter and editor who writes about technology and business. Previously he was the editorial director at ZDNET and the editor of silicon.com.