arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2504.04553cs.HC
收藏

像专业人员一样理解代码库!面向代码理解的人机协作

Understanding Codebase like a Professional! Human-AI Collaboration for Code Comprehension

Johns Hopkins University(约翰斯·霍普金斯大学);Metatrust Labs(MetaTrust实验室);Singapore Management University(新加坡管理大学);Fudan University(复旦大学);Singapore-MIT Alliance for Research and Technology(新加坡-麻省理工学院研究联盟);University of California, San Diego(加利福尼亚大学圣地亚哥分校);North Carolina State University(北卡罗来纳州立大学)

Jie Gao, Yue Xue, Xiaofei Xie, SoeMin Thant, Erika Lee, Bowen Xu

AI总结:

CodeMap通过动态信息提取和交互式可视化,提升代码理解的直观性和易用性,减少对LLM响应的依赖。

摘要:

理解一个不熟悉的代码库是开发者在各种场景下必不可少的任务,例如在入职过程中。特别是当代码库很大且时间有限时,即使有LLM的帮助,实现一定程度的理解仍然对有经验的和新手开发者来说都具有挑战性。现有研究表明,LLM经常无法帮助用户理解代码结构,或在现实环境中无法提供以用户为中心、适应性和动态性的帮助。为此,我们提出从一种独特的角色——代码审计员的视角进行学习,其工作经常需要他们每周甚至每天快速熟悉新的代码项目。为此,我们招募并采访了8名代码审计从业者,以了解他们如何掌握代码库的理解。我们识别出四个设计机会:通过自动化代码库信息提取、分解和表示来支持认知对齐,以及通过交互设计减少手动努力和对话干扰。为了验证这四个设计机会,我们设计了一个原型系统CodeMap,它提供动态信息提取和表示,与人类认知流程对齐,并允许在分层代码库可视化之间进行交互切换。然后,我们与9名有经验的开发者和6名新手开发者进行了用户研究。我们的结果表明,CodeMap显著提高了用户对直观性、易用性和支持代码理解的感知,同时减少了79%对阅读和解释LLM响应的依赖,并将地图使用时间增加了90%相比静态可视化分析工具。

英文摘要:

Understanding an unfamiliar codebase is an essential task for developers in various scenarios, such as during the onboarding process. Especially when the codebase is large and time is limited, achieving a decent level of comprehension remains challenging for both experienced and novice developers, even with the assistance of LLMs. Existing studies have shown that LLMs often fail to support users in understanding code structures or to provide user-centered, adaptive, and dynamic assistance in real-world settings. To address this, we propose learning from the perspective of a unique role, code auditors, whose work often requires them to quickly familiarize themselves with new code projects on a weekly or even daily basis. To achieve this, we recruited and interviewed 8 code auditing practitioners to understand how they master codebase understanding. We identified four design opportunities for an LLM-based codebase understanding system: supporting cognitive alignment through automated codebase information extraction, decomposition, and representation, as well as reducing manual effort and conversational distraction through interaction design. To validate these four design opportunities, we designed a system prototype, CodeMap, that provides dynamic information extraction and representation aligned with the human cognitive flow and enables interactive switching among hierarchical codebase visualizations. We then conducted a user study with nine experienced developers and six novice developers. Our results demonstrate that CodeMap significantly improved users' perceived intuitiveness, ease of use, and usefulness in supporting code comprehension, while reducing their reliance on reading and interpreting LLM responses by 79% and increasing map usage time by 90% compared to the static visualization analysis tool.

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

↑