NRevisit:一种用于代码可理解性评估的认知行为度量
NRevisit: A Cognitive Behavioral Metric for Code Understandability Assessment
AI总结:
本文提出NRevisit动态度量,通过眼动追踪统计程序员对代码区域的回访次数,以个性化评估代码可理解性,实验验证其与脑电认知负荷高度相关。
摘要:
衡量代码可理解性既高度相关又极具挑战性。本文提出了一种动态代码可理解性评估方法,该方法从处理代码的特定程序员的角度估计个性化的代码可理解性分数。该方法包括将正在开发或审查中的代码单元动态划分为代码区域(对程序员不可见),并使用对每个区域的回访次数(NRevisit)作为估计代码可理解性分数的主要特征。这种方法消除了静态软件代码复杂度度量所假定的“典型程序员”概念相关的不确定性,并且可以使用简单、低成本、非侵入性的桌面眼动仪甚至标准计算机摄像头轻松实现。该度量通过脑电图(EEG)测量的认知负荷在35名程序员的受控实验中进行了评估。结果表明,使用不同NRevisit替代方案获得的分数与以程序员认知负荷的EEG测量为代表的地面真值之间存在非常高的相关性,范围从rs = 0.9067到rs = 0.9860(p接近0),证明了我们的方法在反映代码理解所需认知努力方面的有效性。本文还讨论了NRevisit可能的实际应用,包括其在人工智能生成代码背景下的使用,这已在当今被广泛使用。
英文摘要:
Measuring code understandability is both highly relevant and exceptionally challenging. This paper proposes a dynamic code understandability assessment method, which estimates a personalized code understandability score from the perspective of the specific programmer handling the code. The method consists of dynamically dividing the code unit under development or review in code regions (invisible to the programmer) and using the number of revisits (NRevisit) to each region as the primary feature for estimating the code understandability score. This approach removes the uncertainty related to the concept of a "typical programmer" assumed by static software code complexity metrics and can be easily implemented using a simple, low-cost, and non-intrusive desktop eye tracker or even a standard computer camera. This metric was evaluated using cognitive load measured through electroencephalography (EEG) in a controlled experiment with 35 programmers. Results show a very high correlation ranging from rs = 0.9067 to rs = 0.9860 (with p nearly 0) between the scores obtained with different alternatives of NRevisit and the ground truth represented by the EEG measurements of programmers' cognitive load, demonstrating the effectiveness of our approach in reflecting the cognitive effort required for code comprehension. The paper also discusses possible practical applications of NRevisit, including its use in the context of AI-generated code, which is already widely used today.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。