2024-11-11 · 进阶 · 数据科学 · 机器学习

Improving the detection of technical debt in Java source code with an enriched dataset

本文提出了一种基于丰富数据集的Java源代码技术债务检测方法,通过分析代码注释和关联源代码,显著提高了技术债务检测的准确性和性能。

更新于 2024-11-11。作者:Nam Le Hai、Anh M. T. Bui、Phuong T. Nguyen、Davide Di Ruscio、Rick Kazman。

中文摘要

技术债务(TD)是一个术语,用于描述当开发者在解决问题时选择了快速且简单的解决方案,而不是更有效且设计良好的、但耗时较长的方案时,所产生的额外工作和成本。自认技术债务(SATDs)是一种特定的技术债务,开发者有意记录并承认,通常通过文本注释。虽然这些自认注释是识别技术债务的有用工具,但大多数现有方法都专注于捕捉与各种类型技术债务相关的关键标记,而忽视了源代码中嵌入的丰富信息。最近的研究集中于通过分析源代码中嵌入的注释来检测SATDs,而在处理源代码中包含的技术债务方面的工作却很少。为了填补这一空白,在这项研究中,通过对Stack语料库中974个Java项目的注释及其相关源代码进行分析,我们编制了第一个由代码注释识别的技术债务数据集,并附带其相关源代码。通过实证评估,我们发现该数据集的注释有助于提高最先进SATD检测模型的预测性能。更重要的是,包括分类源代码显著提高了预测各种类型技术债务的准确性。在这方面,我们的工作具有双重意义:(i)我们相信我们的数据集将催化该领域的未来工作,激发与识别技术债务相关的各种研究问题;(ii)所提出的分类器可以作为其他基于精心编制数据集检测技术债务研究的基础线。

英文摘要

Technical debt (TD) is a term used to describe the additional work and costs that emerge when developers have opted for a quick and easy solution to a problem, rather than a more effective and well-designed, but time-consuming approach. Self-Admitted Technical Debts (SATDs) are a specific type of technical debts that developers intentionally document and acknowledge, typically via textual comments. While these self-admitted comments are a useful tool for identifying technical debts, most of the existing approaches focus on capturing crucial tokens associated with various categories of TD, neglecting the rich information embedded within the source code itself. Recent research has focused on detecting SATDs by analyzing comments embedded in source code, and there has been little work dealing with technical debts contained in the source code. To fill such a gap, in this study, through the analysis of comments and their associated source code from 974 Java projects hosted in the Stack corpus, we curated the first ever dataset of TD identified by code comments, coupled with its associated source code. Through an empirical evaluation, we found out that the comments of the resulting dataset help enhance the prediction performance of state-of-the-art SATD detection models. More importantly, including the classified source code significantly improves the accuracy in predicting various types of technical debt. In this respect, our work is two-fold: (i) We believe that our dataset will catalyze future work in the domain, inspiring various research issues related to the recognition of technical debt; (ii) The proposed classifiers may serve as baselines for other studies on the detection of TD by means of the curated dataset.

解读

一句话总结

本文提出了一种基于丰富数据集的Java源代码技术债务检测方法,通过分析代码注释和关联源代码,显著提高了技术债务检测的准确性和性能。

问题1:这篇论文想要解决什么具体问题?

• 问题背景:技术债务(TD)是软件开发中常见的现象,对软件质量和维护成本有重大影响。然而,现有的技术债务检测方法主要依赖于文本注释,忽略了源代码本身丰富的信息。 • 现有方案不足:现有方法主要关注捕获与各种技术债务类别相关的关键标记,而忽略了源代码中嵌入的丰富信息。 • 研究目标:提出一种基于丰富数据集的Java源代码技术债务检测方法,通过分析代码注释和关联源代码,提高技术债务检测的准确性和性能。

问题2:论文的核心创新点是什么?

• 技术创新:创建了一个名为TESORO的数据集,该数据集包含通过代码注释识别的技术债务及其关联源代码。 • 方法改进:提出了一种将源代码信息集成到自我承认技术债务(SATD)检测中的新方法。 • 优势:与现有方法相比,TESORO数据集和提出的检测方法显著提高了技术债务检测的准确性和性能。

问题3:实验结果如何验证了方法的有效性?

• 关键实验:通过实验评估了TESORO数据集对现有SATD检测模型预测性能的提升,并验证了将源代码信息集成到SATD检测中的有效性。 • 性能提升:实验结果表明,TESORO数据集和提出的检测方法在技术债务检测方面取得了显著的性能提升。 • 对比结果:与基线方法相比,TESORO数据集和提出的检测方法在准确性和召回率方面均有显著提高。

问题4:这个研究的实际应用价值是什么?

• 应用场景:TESORO数据集和提出的检测方法可以应用于软件开发和维护过程中,帮助开发者识别和修复技术债务,提高软件质量和维护效率。 • 实施建议:建议将TESORO数据集和提出的检测方法应用于实际项目中,以验证其有效性和实用性。 • 局限与展望:虽然TESORO数据集和提出的检测方法在技术债务检测方面取得了显著成果,但仍需进一步研究以解决代码理解中的挑战,并提高检测的准确性和全面性。

来源