论文标题
关于Java中可维护方法尺寸的实证研究
An Empirical Study on Maintainable Method Size in Java
论文作者
论文摘要
代码指标已被广泛用于估计软件维护工作。指标通常用于指导开发人员的工作,以减轻或避免将来的维护负担。尺寸是最简单,最广泛部署的度量标准。大小指标是普遍存在的,因为大小与许多其他常见的指标(例如McCabe的复杂性,可读性等)相关。鉴于计算方法的尺寸以及这些指标在工业环境中的普遍性,令人惊讶的是,没有进行系统的研究来为开发人员提供有关未来维护工作的有意义的方法大小指南。在本文中,我们研究了大约785k Java方法的演变,并表明开发人员应努力将其Java方法保持在24行的长度下。此外,我们表明,将较大的方法分解为较小的方法也减少了整体维护工作。综上所述,这些发现提供了经验指南,以帮助开发人员以减少未来维护的方式设计其系统。
Code metrics have been widely used to estimate software maintenance effort. Metrics have generally been used to guide developer effort to reduce or avoid future maintenance burdens. Size is the simplest and most widely deployed metric. The size metric is pervasive because size correlates with many other common metrics (e.g., McCabe complexity, readability, etc.). Given the ease of computing a method's size, and the ubiquity of these metrics in industrial settings, it is surprising that no systematic study has been performed to provide developers with meaningful method size guidelines with respect to future maintenance effort. In this paper we examine the evolution of around 785K Java methods and show that developers should strive to keep their Java methods under 24 lines in length. Additionally, we show that decomposing larger methods to smaller methods also decreases overall maintenance efforts. Taken together, these findings provide empirical guidelines to help developers design their systems in a way that can reduce future maintenance.