AI Coding Boom Raises Concerns Over Code Quality
January 31, 2024In the fast-paced realm of AI software development, a recent study by developer analytics company GitClear delves into the impact of AI on code quality, revealing worrisome trends that have emerged in the coding landscape.
The research, based on an extensive dataset of 150 million changed lines of code, scrutinizes the effects of AI on code churn, a phenomenon where code is added but promptly deleted, and an increasing prevalence of repeated code. The dataset comprises two-thirds of data from private corporations engaging in anonymized data sharing and one-third from open source projects, predominantly from major players like Google, Facebook, and Microsoft.
While GitHub’s Copilot, a prominent AI coding assistant, has gained substantial traction with over 1 million developers subscribing to its services, the GitClear study shifts the spotlight from quantity to quality. The researchers point out concerns related to code churn and emphasize that AI assistants primarily provide suggestions for adding code, neglecting crucial aspects like updating, moving, or deleting code.
GitClear suggests that code suggestion algorithms are inclined to propose additions that are more likely to be accepted, potentially sacrificing code conciseness and readability. The study also notes a surge in copy/pasted code, criticizing it as a “scourge” to long-term code maintainability.
The research identifies noteworthy trends, including a surge in the amount of added, deleted, updated, and copy/pasted code, coupled with a decline in instances of code being moved. Code movement often indicates refactoring, a practice aimed at enhancing code design and structure without altering its behavior.
While the reasons behind these trends remain speculative, the researchers attribute them to the growing use of AI coding techniques. They caution against the detrimental impact of increased copy/pasting, emphasizing its adverse effects on the long-term maintainability of code.
Despite the identified issues, the researchers refrain from offering specific solutions, leaving room for future research. However, they recommend engineering leaders to monitor incoming data and consider its implications for future product maintenance.
The study provides a nuanced perspective on AI coding assistants, asserting that while they are here to stay and may evolve, developers must optimize their use. The findings may offer reassurance to developers concerned about being replaced by AI, echoing a recent study by CodeScene, which concluded that current AI capabilities are insufficient to replace humans in coding contexts due to their error-prone nature.
As the AI coding wave continues to reshape software development, the GitClear research underscores the need for a balanced approach that addresses both the advantages and challenges posed by AI-driven coding assistance.