论文标题
分析依赖注入对软件可维护性的影响
Analyzing Impact of Dependency Injection on Software Maintainability
论文作者
论文摘要
通常已知依赖注入(DI)通过将应用程序类别与库分开来提高可维护性。特别是在Java环境中,有许多应用使用DI原理,目的是提高可维护性。有一些工作可以推断DI对可维护性的影响,但没有提供任何结论性证据。没有公开可用的工具来量化DI的事实使得这样的证据更难以生产。在本文中,我们提出了一个新型的指标DCBO,以根据加权耦合来测量项目中DI的比例。我们描述了当还考虑DI时,DCBO如何用作计算可维护性的更有意义的指标。该度量是在CKJM-Analyzer中实现的,CKJM-Analyzer是使用静态代码分析检测DI的CKJM工具的扩展。我们讨论了静态分析背后的算法方法,并使用一组开源Java项目证明了该工具的健全性。
Dependency injection (DI) is generally known to improve maintainability by keeping application classes separate from the library. Particularly within the Java environment, there are many applications using the principles of DI with the aim to improve maintainability. There exists some work that provides an inference on the impact of DI on maintainability, but no conclusive evidence is provided. The fact that there are no publicly available tools for quantifying DI makes such an evidence more difficult to be produced. In this paper, we propose a novel metric, DCBO, to measure the proportion of DI in a project based on weighted couplings. We describe how DCBO can serve as a more meaningful metric in computing maintainability when DI is also considered. The metric is implemented in the CKJM-Analyzer, an extension of the CKJM tool that utilizes static code analysis to detect DI. We discuss the algorithmic approach behind the static analysis and prove the soundness of the tool using a set of open-source Java projects.