论文标题
对格式元素对代码可读性的影响的系统文献综述
A Systematic Literature Review on the Impact of Formatting Elements on Code Legibility
论文作者
论文摘要
上下文:软件程序可以以不同但功能等效的方式编写。即使以前的研究比较了特定的格式元素,以找出哪种替代方案影响代码的知名度,但看到使代码或多或少易读的更大了解是具有挑战性的。目标:我们旨在查找在经验研究中研究了哪些格式元素,并且发现哪些替代方案对于人类受试者来说更清晰。方法:我们进行了系统的文献综述,并确定了15篇文章,其中包含以人为本的研究,这些研究直接比较了替代格式的元素。我们使用卡片排序方法分析并组织了这些格式元素。结果:我们确定了13个格式元素(例如,凹痕)和33个格式元素(例如,两个空间凹痕)的级别,这些元素涉及格式化样式,间距,块,屏蔽定界符,长或复杂的代码线和单词边界样式。尽管某些级别在统计学上比其他等效的级别在代码可读性方面要好得多,例如,与块相适当使用压痕,而另一些则不是格式化布局。对于标识符样式,我们发现了不同的结果,其中一项研究发现骆驼案的显着差异,而另一项研究发现有利于蛇例的阳性结果。结论:已确定的论文数量,其中一些已过时,许多无效和矛盾的结果强调了该领域的相对缺乏工作,并强调了更多研究的重要性。关于格式元素如何在创建准则和自动化辅助工具之前如何影响代码可读性,以帮助开发人员使其代码更加清晰。
Context: Software programs can be written in different but functionally equivalent ways. Even though previous research has compared specific formatting elements to find out which alternatives affect code legibility, seeing the bigger picture of what makes code more or less legible is challenging. Goal: We aim to find which formatting elements have been investigated in empirical studies and which alternatives were found to be more legible for human subjects. Method: We conducted a systematic literature review and identified 15 papers containing human-centric studies that directly compared alternative formatting elements. We analyzed and organized these formatting elements using a card-sorting method. Results: We identified 13 formatting elements (e.g., indentation) and 33 levels of formatting elements (e.g., two-space indentation), which are about formatting styles, spacing, block delimiters, long or complex code lines, and word boundary styles. While some levels were found to be statistically better than other equivalent ones in terms of code legibility, e.g., appropriate use of indentation with blocks, others were not, e.g., formatting layout. For identifier style, we found divergent results, where one study found a significant difference in favor of camel case, while another study found a positive result in favor of snake case. Conclusion: The number of identified papers, some of which are outdated, and the many null and contradictory results emphasize the relative lack of work in this area and underline the importance of more research. There is much to be understood about how formatting elements influence code legibility before the creation of guidelines and automated aids to help developers make their code more legible.