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

Java中维护方法大小的实证研究

An Empirical Study on Maintainable Method Size in Java

Shaiful Alam Chowdhury, Gias Uddin, Reid Holmes

摘要:

代码度量已被广泛用于评估软件维护工作。一般来说,开发人员会使用这些工具来减少或避免未来的维护负担。规模是最简单和最广泛使用的度量标准。大小度量是普遍的,因为大小与许多其他常见度量(例如,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.

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

↑