Linking Code Readability, Structure, and Comprehension Among Novices: It's Complicated
Linking Code Readability, Structure, and Comprehension Among Novices: It's Complicated
复制标题
将新手的代码可读性、结构和理解联系起来:很复杂
DOI:
--
复制
发表时间:
2019
期刊:
影响因子:
--
通讯作者:
A. Fox
中科院分区:
文献类型:
--
作者:
E. Wiese;Anna N. Rafferty;A. Fox
Novices' functionally-correct code is often redundant, verbose, or un-idiomatic. Such code could indicate shallow understanding of the programming language, or unfamiliarity with experts' preferences for code structure. Understanding why novices write poorly is important for designing instruction and tools to help novices write elegantly. 231 novices judged style and readability for sets of code snippets targeting seven topics. Within each set, functionality was the same, but the writing followed either common novice patterns or a more elegant, "expert" pattern. Overall, 76% of novices thought the "expert" snippets had the best style, but only 64% said those snippets were most readable. However, comprehension was similar for both "expert" and novice patterns, regardless of readability preferences. This suggests that students who prefer novice patterns do not necessarily have deep misunderstandings about the programming language. One topic included a code-writing task, and students' readability preferences were predictive of their code-writing patterns, suggesting that readability preferences reflect writing choices rather than comprehension. Thus, novices may benefit from lightweight tools that identify common patterns and suggest an "expert" solution, while helping them see that the "expert" solution is more readable than they think.