Welcome back to the the 6th post in the series on understanding code complexity and maintainability. Over the last few post we have talked about Line Of Code , Class Coupling , Depth of Inheritance and Cyclomatic Complexity metrics. In this post we will talk about overall Maintainability Index code metrics. The maintainability index value measured between an index from 0 to 100. Higher values of this index indicates the better maintainability of code.
The maintainability index calculates in each and every level of code and it bubbling up to project or namespace level with an average value. This index is based on several other metrics that we have already discussed such as
Here is how this calculate :
Maintainability Index = MAX(0,(171 – 5.2 * ln(Halstead Volume) – 0.23 * (Cyclomatic Complexity) – 16.2 * ln(Lines of Code))*100 / 171)
The Maintainability Index column also includes a set of icons to give an overall indication of maintainability
Code Maintainable Index is one of the important metrics that indicates how easy to maintain your code. When you start writing code for a particular method, the maintainability index starts from 100. with the changes on the code and other metrics factor the index start decreasing
Here is one must use Visual Studio Extension that shows the maintainability index on the fly.
Hope this helps !