arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2504.19225cs.SE
收藏

提供关于已实现算法的信息能改善程序理解:一项对照实验

Providing Information About Implemented Algorithms Improves Program Comprehension: A Controlled Experiment

Denis Neumüller, Alexander Raschke, Matthias Tichy

AI总结:

该研究通过56人的对照实验发现,在源代码中标注算法标签能显著提升程序理解正确率约23%,且不影响完成时间,尤其对中等经验开发者帮助显著。

摘要:

背景:多种方法旨在通过自动检测源代码中的算法来支持程序理解。然而,目前尚未对其帮助性进行过实证评估。目标:实证评估算法标签(包含算法名称及附加信息)如何从正确性和时间方面影响程序理解。方法:我们进行了一项包含56名参与者的对照实验,实验组获得带有算法标签的代码。各组完成了旨在测量程序理解的练习,以及关于标签帮助性、算法识别用例和实践中自我实现算法原因的问卷。结果:用算法标签标注源代码显著改善了程序理解(p=0.040),中位数提升6分(约23%),但不影响完成时间(p=0.991)。定性分析显示,大多数参与者认为标签有帮助,特别是对于识别代码意图。参与者还提出了错误检测、优化和库替换等用例。自我实现算法的原因包括库的不足、性能需求以及避免依赖或许可成本。结论:本研究表明算法标签能改善程序理解,特别是对于具有中等编程经验的开发者。我们的定性分析还揭示了参与者如何从标签中受益、算法识别的进一步用例以及自我实现算法背后的动机。

英文摘要:

Context: Various approaches aim to support program comprehension by automatically detecting algorithms in source code. However, no empirical evaluations of their helpfulness have been performed. Objective: To empirically evaluate how algorithm labels - which include the algorithm's name and additional information - impact program comprehension in terms of correctness and time. Method: We conducted a controlled experiment with 56 participants, where the experimental group received code with labeled algorithms. The groups completed exercises designed to measure program comprehension as well as a post-questionnaire on label helpfulness, use cases for algorithm recognition, and reasons for self-implementation of algorithms in practice. Results: Annotating source code with algorithm labels significantly improves program comprehension (p=0.040), with a median improvement of 6 points (~23%), but does not affect completion times (p=0.991). Qualitative analysis revealed that a majority of participants perceived the labels as helpful, especially for recognizing the codes intent. Participants also proposed use cases such as error detection, optimization, and library replacement. Reasons for self-implementing algorithms included library inadequacies, performance needs and avoiding dependencies or licensing costs. Conclusion: This study shows that algorithm labels improve program comprehension, especially for developers with medium programming experience. Our qualitative analysis also sheds light on how participants benefit from the labels, further use cases for algorithm recognition and motivations behind self-implementing algorithms.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑