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.
翻译:代码搜索引擎通常使用可读性特性来排序代码片断。 有好几项指标可以计算此特性, 但开发者可能对可读性有不同的看法。 已经提出了可读性和可理解性之间的关联, 即开发者需要阅读和理解代码片断语法, 但也需要理解语义。 这项工作根据对代码片断理解的可能主观认识来调查可读性和可读性特性的分数。 我们发现, 读性得分较高的代码片断比低的要更能理解。 可理解性评分显示在特定情况下, 如嵌套环或“ 叶子链 ” 。 开发者还提到可写性是评估代码片断理解的主要特征。 这些结果为今后在代码理解性评分优化中的工作提供了洞察力。