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

评估代码可读性和易读性:以人为中心的研究

Evaluating Code Readability and Legibility: An Examination of Human-centric Studies

Delano Oliveira, Reydne Bruno, Fernanda Madeiral, Fernando Castor

摘要:

阅读代码是软件维护和演化中的一项基本活动。几项针对人类受试者的研究调查了不同的因素,如所采用的编程结构和命名约定,如何影响代码的可读性,即,什么使程序更容易或更难被开发者阅读和理解,以及代码易读性,即,是什么影响了识别程序元素的容易性。这些研究通过不同的理解任务和反应变量来评估可读性和易读性。在本文中,我们在比较编程结构、编码习惯、命名约定和格式指南的研究中检查了这些任务和变量,例如,递归代码与迭代代码。为此,我们进行了系统的文献综述,发现了54篇相关论文。这些研究大多通过测量受试者结果的正确性(83.3%)或简单地询问他们的意见(55.6%)来评估代码的可读性和易读性。一些研究(16.7%)完全依赖于后一个变量。仍然有少数研究监测受试者的身体体征,如大脑激活区域(5%)。此外,我们的研究表明,一些变量是多方面的。例如,正确性可以被衡量为预测程序输出的能力,回答有关其行为的问题,或回忆部分内容。这些结果清楚地表明,不同的评估方法需要不同的能力,例如,跟踪程序vs.总结其目标vs.记住其文本。为了帮助研究人员设计新的研究,并提高我们对现有研究的理解,我们通过调整预先存在的学习分类法,将程序理解建模为一种学习活动。这一调整表明,在这些评价中经常运用某些能力,而很少针对其他能力。

英文摘要:

Reading code is an essential activity in software maintenance and evolution. Several studies with human subjects have investigated how different factors, such as the employed programming constructs and naming conventions, can impact code readability, i.e., what makes a program easier or harder to read and apprehend by developers, and code legibility, i.e., what influences the ease of identifying elements of a program. These studies evaluate readability and legibility by means of different comprehension tasks and response variables. In this paper, we examine these tasks and variables in studies that compare programming constructs, coding idioms, naming conventions, and formatting guidelines, e.g., recursive vs. iterative code. To that end, we have conducted a systematic literature review where we found 54 relevant papers. Most of these studies evaluate code readability and legibility by measuring the correctness of the subjects' results (83.3%) or simply asking their opinions (55.6%). Some studies (16.7%) rely exclusively on the latter variable.There are still few studies that monitor subjects' physical signs, such as brain activation regions (5%). Moreover, our study shows that some variables are multi-faceted. For instance, correctness can be measured as the ability to predict the output of a program, answer questions about its behavior, or recall parts of it. These results make it clear that different evaluation approaches require different competencies from subjects, e.g., tracing the program vs. summarizing its goal vs. memorizing its text. To assist researchers in the design of new studies and improve our comprehension of existing ones, we model program comprehension as a learning activity by adapting a preexisting learning taxonomy. This adaptation indicates that some competencies are often exercised in these evaluations whereas others are rarely targeted.

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

↑