Linking Code Readability, Structure, and Comprehension Among Novices: It's Complicated

Linking Code Readability, Structure, and Comprehension Among Novices: It's Complicated
复制标题

将新手的代码可读性、结构和理解联系起来:很复杂

DOI:
--
复制
发表时间:
2019
期刊:
2019 IEEE/ACM 41st International Conference on Software Engineering: Software Engineering Education and Training (ICSE-SEET)
影响因子:
--
通讯作者:
A. Fox
A. Fox
中科院分区:
--
文献类型:
--
作者:
E. Wiese;Anna N. Rafferty;A. Fox

文献摘要

被引文献

相似文献

新手的功能正确的代码通常是冗余的、冗长的或不习惯的。这样的代码可能表明对编程语言的理解很浅,或者不熟悉专家对代码结构的偏好。理解新手写作不佳的原因对于设计指导和工具帮助新手优雅地写作很重要。231名新手对针对七个主题的代码片段集的风格和可读性进行了评判。在每一套中,功能都是相同的,但写作遵循常见的新手模式或更优雅的“专家”模式。总体而言,76%的新手认为“专家”片段的风格最好,但只有64%的人认为这些片段最可读。然而,无论可读性偏好如何,“专家”和新手模式的理解都是相似的。这表明喜欢新手模式的学生不一定对编程语言有很深的误解。一个主题包括代码编写任务,学生的可读性偏好预测他们的代码编写模式,这表明可读性偏好反映了写作选择,而不是理解。因此,初学者可以从轻量级工具中受益,这些工具可以识别常见模式并建议“专家”解决方案,同时帮助他们看到“专家”解决方案比他们想象的更具可读性。
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.