Measurement of Maintainability Index (MI) with Testwell CMT++ and CMTJava (Complexity Measurement Tools)
Testwell CMT++ and CMTJava
are tools for software complexity measurement for C, C++, Java und C#.
The tools show Maintainability Index
Maintainability Index (MI) MI is a single-number value for estimating the relative maintainability of the code.
Maintainability Index is calculated with certain formulae from lines-of-code measurement, McCabe- and Halstead measurement.
The measurement and track maintainability are intended to help reduce or reverse a system's tendency toward "code entropy" or degraded integrity, and to indicate when it becomes cheaper and/or less risky to rewrite the code instead to change it.
There are two variants of Maintainability Index:
- Maintainability Index with comments (MI)
- Maintainability Index which does not contain comments (MIwoc).
Testwell CMT++ and CMTJava calculate them both. The tools calculate Maintainability Index for functions (and class/struct definitions), for files and for the whole software.
Meanings of the Maintainability Index (MI, with comments) values: 85 and more: good maintainability
65-85: moderate maintainability
unter 65: difficult to maintain
with really bad pieces of code (big, uncommented, unstructured) the MI value can be even negative
To realize the full benefit of MI, the maintenance environment must allow the rewriting of a module when it becomes measurably unmaintainable. The point of measuring the MI is to identify risk; when unacceptably risky code is identified, it should be rewritten.
Calculation of Maintainability Index
Maintainability Index is calculated on each function/class/struct, on each file and on all files together level.
Actually there are three measures:
- MIwoc: Maintainability Index without comments
- MIcw: Maintainability Index comment weight
- MI: Maintainability Index = MIwoc + MIcw
The general formulae for MI is the following:
MIwoc = 171 - 5.2 * ln(aveV) -0.23 * aveG -16.2 * ln(aveLOC)
MIcw = 50 * sin(sqrt(2.4 * perCM))
MI = MIwoc + MIcw
aveV = average Halstead Volume (CMT++/CMTJava´s V)
aveG = average extended cyclomatic complexity (CMT++/CMTJava´s v(G) )
aveLOC = average count of lines (CMT++/CMTJava´s LOCphy)
perCM = average percent of lines of comments per Module
A "Module" (in CMT++ case) a C-like function definition, a C++-like member function definition, or a class/struct definition.
Testwell CMT++ und CMTJava show following Software Metrics:
Besides Testwell CMT++ and CMTJava
Verifysoft Technology offers following tool which measures Software Complexity:
We support you in order to choose the most suitable tool for you
Contact us now