arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2402.06013cs.SE
收藏

如何重构这段代码?开发者与ChatGPT重构对话的探索性研究

How to Refactor this Code? An Exploratory Study on Developer-ChatGPT Refactoring Conversations

Eman Abdullah AlOmar, Anushkrishna Venkatakrishnan, Mohamed Wiem Mkaouer, Christian D. Newman, Ali Ouni

AI总结:

本研究通过挖掘17,913条开发者与ChatGPT的重构对话,揭示开发者常提出通用重构请求,而ChatGPT回应包含明确意图,并识别出多种提示学习设置,为AI辅助重构协作提供洞见。

摘要:

大型语言模型(LLMs),如ChatGPT,已在各种软件工程任务中获得了广泛普及和使用,包括重构、测试、代码审查和程序理解。尽管最近的研究深入探讨了提交消息、问题和代码审查中的重构文档,但关于开发者在与ChatGPT交互时如何表达其重构需求,我们知之甚少。在本文中,我们的目标是探索开发者与ChatGPT之间与重构相关的对话,以更好地理解开发者如何识别代码中需要改进的领域,以及ChatGPT如何满足开发者的需求。我们的方法依赖于从17,913个ChatGPT提示和响应中通过文本挖掘提取与重构相关的对话,并调查开发者明确的重构意图。我们的结果显示:(1)开发者与ChatGPT的对话通常涉及通用和特定的术语/短语;(2)开发者经常提出通用的重构请求,而ChatGPT通常包含重构意图;(3)在重构上下文中提示ChatGPT时存在各种学习设置。我们设想,我们的发现有助于更广泛地理解在代码重构背景下开发者与AI模型之间的协作,对模型改进、工具开发和软件工程最佳实践具有启示意义。

英文摘要:

Large Language Models (LLMs), like ChatGPT, have gained widespread popularity and usage in various software engineering tasks, including refactoring, testing, code review, and program comprehension. Despite recent studies delving into refactoring documentation in commit messages, issues, and code review, little is known about how developers articulate their refactoring needs when interacting with ChatGPT. In this paper, our goal is to explore conversations between developers and ChatGPT related to refactoring to better understand how developers identify areas for improvement in code and how ChatGPT addresses developers' needs. Our approach relies on text mining refactoring-related conversations from 17,913 ChatGPT prompts and responses, and investigating developers' explicit refactoring intention. Our results reveal that (1) developer-ChatGPT conversations commonly involve generic and specific terms/phrases; (2) developers often make generic refactoring requests, while ChatGPT typically includes the refactoring intention; and (3) various learning settings when prompting ChatGPT in the context of refactoring. We envision that our findings contribute to a broader understanding of the collaboration between developers and AI models, in the context of code refactoring, with implications for model improvement, tool development, and best practices in software engineering.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑