A key aspect of technical debt (TD) management is the ability to measure the amount of principal accumulated in a system. The current literature contains an array of approaches to estimate TD principal, however, only a few of them focus specifically on architectural TD, and none of these are fully automated, freely available, and thoroughly validated. Moreover, a recent study has shown that many of the current approaches suffer from certain shortcomings, such as relying on hand-picked thresholds. In this paper, we propose a novel approach to estimate architectural technical debt principal based on machine learning and architectural smells to address such shortcomings. Our approach can estimate the amount of technical debt principal generated by a single architectural smell instance. To do so, we adopt novel techniques from Information Retrieval to train a learning-to-rank machine learning model that estimates the severity of an architectural smell and ensure the transparency of the predictions. Then, for each instance, we statically analyse the source code to calculate the exact number of lines of code creating the smell. Finally, we combine these two values to calculate the technical debt principal. To validate the approach, we conducted a case study and interviewed 16 practitioners, from both open source and industry, and asked them about their opinions on the TD principal estimations for several smells detected in their projects. The results show that for 71\% of instances, practitioners agreed that the estimations provided were \emph{representative} of the effort necessary to refactor the smell.
翻译:技术债务管理的一个关键方面是能够衡量系统中累积的本金金额。当前文献中包含多种估算技术债务本金的方法,然而,其中仅有少数方法专门关注架构技术债务,并且没有一种方法能够完全自动化、免费获取且经过充分验证。此外,近期一项研究表明,许多现有方法存在某些缺陷,例如依赖人工设定的阈值。在本文中,我们提出了一种基于机器学习与架构坏味的新型架构技术债务本金估算方法,以解决上述缺陷。我们的方法可估算单个架构坏味实例所产生的技术债务本金金额。为此,我们采用信息检索领域的新型技术,训练一个学习排序的机器学习模型,以估算架构坏味的严重程度,并确保预测结果的透明度。随后,针对每个实例,我们静态分析源代码,以计算产生该坏味的精确代码行数。最后,我们将这两个值相结合,以计算技术债务本金。为验证该方法,我们进行了一项案例研究,并采访了来自开源社区和工业界的16位从业者,询问他们对其项目中检测到的多个坏味的技术债务本金估算值的看法。结果表明,在71%的实例中,从业者认同所提供的估算值能够反映重构该坏味所需的工作量。