程序员在上下文感知代码摘要过程中的视觉注意力
Programmer Visual Attention During Context-Aware Code Summarization
AI总结:
本研究通过眼动追踪实验,发现程序员在上下文感知代码摘要中注意力随经验减少,且存在最优阅读量,为改进自动摘要提供依据。
摘要:
摘要:程序员注意力代表程序员在执行编程任务时对源代码部分的视觉关注。我们进行了一项深入的人体研究,涉及10名Java程序员,每位程序员在五个一小时的会话中为来自五个大型Java项目的40个方法生成摘要。我们使用眼动追踪设备来映射程序员编写摘要时的视觉注意力。我们还对每个摘要的质量进行评分。我们发现了定义程序员在上下文感知代码摘要期间注意力共同行为的眼动模式和指标。具体来说,我们发现程序员在一个会话中总结更多方法时,需要阅读的单词数量显著减少(p<0.01),并且对单词的重新访问次数显著减少(p<0.03),同时保持摘要质量。我们还发现,参与者查看的源代码数量与更高质量的摘要相关,但这种趋势呈钟形曲线,即超过某个阈值后,阅读更多源代码会导致摘要质量显著下降(p<0.01)。我们还根据程序员的注意力,深入了解了项目中哪些类型的方法为代码摘要提供了最多的上下文信息。具体来说,我们观察到程序员大部分时间都在查看与目标方法同一类中的方法。令人惊讶的是,我们发现程序员在目标方法的调用图中查看方法的时间显著减少。我们讨论了我们的实证观察如何有助于未来研究建模程序员注意力并改进上下文感知的自动源代码摘要。
英文摘要:
Abridged: Programmer attention represents the visual focus of programmers on parts of the source code in pursuit of programming tasks. We conducted an in-depth human study with 10 Java programmers, where each programmer generated summaries for 40 methods from five large Java projects over five one-hour sessions. We used eye-tracking equipment to map the visual attention of programmers while they wrote the summaries. We also rate the quality of each summary. We found eye-gaze patterns and metrics that define common behaviors between programmer attention during context-aware code summarization. Specifically, we found that programmers need to read significantly (p<0.01) fewer words and make significantly (p<0.03) fewer revisits to words as they summarize more methods during a session, while maintaining the quality of summaries. We also found that the amount of source code a participant looks at correlates with a higher quality summary, but this trend follows a bell-shaped curve, such that after a threshold reading more source code leads to a significant (p<0.01) decrease in the quality of summaries. We also gathered insight into the type of methods in the project that provide the most contextual information for code summarization based on programmer attention. Specifically, we observed that programmers spent a majority of their time looking at methods inside the same class as the target method to be summarized. Surprisingly, we found that programmers spent significantly less time looking at methods in the call graph of the target method. We discuss how our empirical observations may aid future studies towards modeling programmer attention and improving context-aware automatic source code summarization.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。