The Software Maintainability Index (MI) is a single-value indicator for the maintainability of a software system. It was proposed by Oman and Hagemeister in the early nineties. [1]
The Maintainability Index is computed by combining four traditional metrics: It is a weighted composition of the average Halstead Volume per module, the Cyclomatic Complexity, the number of lines of code (LOC) and the comment ratio of the system.
The formula [2] for the Maintainability Index is presented in the following figure:
Several static analysis and software development tools, including Microsoft Visual Studio, compute the Maintainability Index [3].
But: What knowledge can you gain if you know that the Maintainability Index of your system is, say, 57?
If you trust in the validity of this Key Performance Indicator (KPI)—despite its obscure formula—you can try to compare your system to others. That’s it. Apart from that, it does not provide more information and, in particular, will not help you in locating the problems and determining what you can do to improve.
Because of this lack of expressiveness, we at CQSE are convinced that this KPI is nonsense. We think that it is not sensible to reduce the maintainability of a whole software system to one single indicator.
In our opinion, a valid KPI needs to satisfy four criteria [4]:
The Maintainability Index does not satisfy these criteria:
Besides, other relevant factors such as the code coverage of regression tests that reveal newly introduced faults during changes are not considered by the Maintainability Index.
For these reasons, our quality analysis tool Teamscale does not compute the Maintainability Index. When we assess the maintainability and complexity of a software system, we use manual reviews, multiple fine-grained checks, and indicators, such as method length, nesting depth, ratio of duplicated code, and more, to gain insights about a system.
Read also what we think about the McCabe’s Cyclomatic Complexity.
[1] Oman, Paul, and Jack Hagemeister. “Metrics for assessing a software system’s maintainability.” In Proc. Conference on Software Maintenance. IEEE, 1992.
[2] Coleman, Don, et al. “Using metrics to evaluate software system maintainability.” Computer 27.8 (1994): 44-49.
[3] msdn.microsoft.com/en-us/library/bb385914.aspx
[4] https://www.cqse.eu/publications/2015-managing-product-quality-in-complex-software-development-projects.pdf