Code modification requires developers to comprehend code, plan changes, articulate intentions, and validate outcomes, making it a cognitively demanding process. Generated natural language code summaries aid comprehension but remain static and limited in supporting the full workflow. We present NaturalEdit, a system that makes code summaries interactive and adaptive representations directly linked to source code. Grounded in the Cognitive Dimensions of Notations, NaturalEdit implements a paradigm of code modification through interaction with natural language representations through three key features: (1) adaptive multi-faceted representation of code summaries with flexible Abstraction Gradient; (2) interactive mapping mechanisms between summaries and codes, ensuring a tight Closeness of Mapping; and (3) intent-driven, bidirectional synchronization that reduces Viscosity in editing and validation. A technical evaluation confirms the performance of NaturalEdit, and a user study with 12 developers shows that it enhances comprehension, intent articulation, and validation, giving developers greater confidence and control.
翻译:代码修改要求开发者理解代码、规划变更、阐明意图并验证结果,是一个认知负荷较高的过程。生成的自然语言代码摘要有助于理解,但其静态特性限制了其对完整工作流的支持。本文提出NaturalEdit系统,该系统使代码摘要成为与源代码直接关联的交互式自适应表征。基于符号认知维度理论,NaturalEdit通过三个关键特性实现了通过自然语言表征交互进行代码修改的范式:(1) 具有灵活抽象梯度的自适应多维度代码摘要表征;(2) 摘要与代码间的交互式映射机制,确保紧密的映射关联;(3) 意图驱动的双向同步机制,降低编辑与验证过程中的操作粘滞。技术评估证实了NaturalEdit的性能表现,对12名开发者的用户研究表明,该系统能提升代码理解、意图阐明和验证效率,使开发者获得更强的掌控感与信心。