Effects of Dependency Injection on Maintainability

E. Razina and D. Janzen (USA)


Maintainability, Dependency Injection, Spring Framework


Software maintenance consumes around 70% of the soft ware life cycle. Improving software maintainability could save software developers significant time and money. This paper examines whether the pattern of dependency injec tion significantly reduces dependencies of modules in a piece of software, therefore making the software more maintainable. This hypothesis is tested with 20 sets of open source projects from sourceforge.net, where each set con tains one project that uses the pattern of dependency in jection and one similar project that does not use the pat tern. The extent of the dependency injection use in each project is measured by a new Number of DIs metric created specifically for this analysis. Maintainability is measured using coupling and cohesion metrics on each project, then performing statistical analysis on the acquired results. Af ter completing the analysis, no correlation was evident be tween the use of dependency injection and coupling and co hesion numbers. However, a trend towards lower coupling numbers in projects with a dependency injection count of 10% or more was observed.

Important Links:

Go Back