Java remains one of the most popular programming languages in education. Although Java programming education is well supported by study materials, learners also need more immediate support on the problems they face in their own code. When this support cannot be offered by educators personally, learners can resort to automated program analysis tools such as linters, which provide feedback on potential bugs or code issues. This is constructive feedback, but it may nevertheless feel like criticism. This paper introduces code perfumes for Java, a simple program analysis technique similar to linting, but commending the correct application of good programming practices. We present a catalogue of 20 Java code perfumes related to common Java language constructs for beginner to immediate learners. Our evaluation shows that these code perfumes occur frequently in learners' code, and programs with more code perfume instances tend to have better functionality and readability. Moreover, students who incorporate more code perfumes tend to achieve higher grades. Thus, code perfumes serve as a valuable tool to acknowledge learners' successes, and as a means to inform instructors about their learners' progress.
翻译:Java在教育领域仍是最流行的编程语言之一。尽管Java编程教育已有丰富的学习资料支持,但学习者仍需要针对其个人代码所面临问题获得更即时性的支持。当教育者无法亲自提供这种支持时,学习者可以借助自动程序分析工具(如代码检查器)来获取关于潜在缺陷或代码问题的反馈。这类反馈具有建设性,但仍可能被感知为批评。本文提出面向Java的代码香氛技术——一种类似于代码检查但旨在肯定良好编程实践正确应用的简易程序分析方法。我们构建了包含20种Java代码香氛的目录,涵盖初阶至中阶学习者常用的Java语言结构。评估结果表明,这些代码香氛在学习者代码中频繁出现,且包含更多代码香氛实例的程序往往具有更好的功能性与可读性。此外,融入更多代码香氛的学生通常能获得更高的课程成绩。因此,代码香氛既可成为肯定学习者成果的有效工具,也能作为教师了解学生学习进展的重要途径。