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

用于代码片段评估的可读性与可理解性评分:一项探索性研究

Readability and Understandability Scores for Snippet Assessment: an Exploratory Study

Carlos Eduardo C. Dantas, Marcelo A. Maia

AI总结:

本研究从主观感知视角考察代码片段的可读性与可理解性评分,发现高可读性评分的代码片段理解效果更好,可理解性评分在嵌套循环等特定情况表现更优,为代码理解评分优化提供了见解。

摘要:

代码搜索引擎通常使用可读性特征来对代码片段进行排名。有几种指标可以计算该特征,但开发者可能对可读性有不同的感知。可读性与可理解性特征之间的相关性已被提出,即开发者不仅需要阅读并理解代码片段的语法,还需要理解其语义。本研究从代码片段理解的可能主观感知视角,考察了可理解性与可读性特征的评分。我们发现,具有较高可读性评分的代码片段比评分较低的代码片段具有更好的理解效果。可理解性评分在特定情况下(例如嵌套循环或if-else链)呈现出更好的理解效果。开发者还提到可写性方面是评估代码片段理解的主要特征。这些结果为未来在代码理解评分优化方面的工作提供了见解。

英文摘要:

Code search engines usually use readability feature to rank code snippets. There are several metrics to calculate this feature, but developers may have different perceptions about readability. Correlation between readability and understandability features has already been proposed, i.e., developers need to read and comprehend the code snippet syntax, but also understand the semantics. This work investigate scores for understandability and readability features, under the perspective of the possible subjective perception of code snippet comprehension. We find that code snippets with higher readability score has better comprehension than lower ones. The understandability score presents better comprehension in specific situations, e.g. nested loops or if-else chains. The developers also mentioned writability aspects as the principal characteristic to evaluate code snippets comprehension. These results provide insights for future works in code comprehension score optimization.

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

↑