一句话:从 58 个 GitHub 项目提炼 58 个维护任务,实证评估 ChatGPT-3.5 与 4o 的软件维护能力,二者分别仅正确完成 30 与 31 个任务。
自 2022 年 ChatGPT 发布以来,已有大量工作研究其在代码生成、缺陷修复、测试生成与程序理解方面的能力,但其在软件维护上的有效性仍缺乏系统评估。本文开展实证研究:作者从 58 个 GitHub 项目中提炼出 58 个软件维护任务,对每个任务分别提示 ChatGPT-3.5 与 ChatGPT-4o 按照给定的维护请求修改相应 Java 文件,再将模型产出的修改与版本历史中开发者的真实修改进行对比以判定正确性。结果显示,ChatGPT-3.5 正确完成了 30 个任务,ChatGPT-4o 正确完成 31 个,均未全部成功;失败的主要原因是模型不必要地截断了 Java 文件、遗漏项目特有的逻辑,或未能覆盖所有边界情况。该现象表明 ChatGPT 可以辅助开发者进行软件维护,但不太可能完全取代开发者。研究刻画了 ChatGPT 在软件维护中的能力边界及其在不同模型版本间的演进,并揭示了其在未来维护实践中的潜在角色。
Since the launch of ChatGPT in 2022, people have conducted various studies to investigate its capabilities in code generation, bug-fixing, test generation, and program comprehension. While ChatGPT has demonstrated strong capabilities in several aspects of software engineering, their effectiveness in maintaining software remains under-explored. Motivated by such a lack of study, we conducted an empirical study to systematically evaluate the performance of ChatGPT in software maintenance. Specifically, we distilled 58 software maintenance tasks from 58 GitHub projects. For each task, we prompted two ChatGPT models—ChatGPT-3.5 and ChatGPT-4o—to separately revise a given Java file, in response to a prescribed maintenance request. Once the models returned results,we assessed each model’s capability by comparing those revisions with developers’ modifications recorded in the version history. We found that ChatGPT-3.5 correctly revised code for 30 of the 58 tasks, while ChatGPT-4o correctly fulfilled 31 tasks. Neither model fulfilled all tasks successfully mainly because they either truncated Java files unnecessarily, missed project-specific logic, or failed to cover all corner cases. This phenomenon implies that ChatGPT can help developers in software maintenance, but is unlikely to replace developers completely. Our study characterizes ChatGPT’s capabilities in software maintenance and its progression across model versions. It also sheds light on ChatGPT’s potential roles in future software-maintenance practices.