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
- Cyclomatic Complexity
- Line Of Code
- and Halstead volume.
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)
Refer: Maintainability Index Range and Meaning
The Maintainability Index column also includes a set of icons to give an overall indication of maintainability
– Low Maintainability – ( When Maintainability Index within range of 0- 9)
– Moderate Maintainability – ( When Maintainability Index within range of 10- 19)
– High Maintainability – ( When Maintainability Index within range of 20- 100)
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
Code Health Indicator – A must have visual studio extensions for all app developers
Here is one must use Visual Studio Extension that shows the maintainability index on the fly.
Hope this helps !
Nice treatment of the subject matter. Useful tools best used in the proper context. Thanks!
Pingback: #overcommit 1 | abandonedmutex
Pingback: Understand the complexity and maintainability of your code using Code Metrics in Visual Studio
Pingback: How to Understand the complexity and maintainability of the code ? | Abhijit's World of .NET
Pingback: Dew Drop – January 4, 2016 (#2160) | Morning Dew
Pingback: 31 Days …. 31 Visual Studio Tips & Tricks from Daily .NET Tips–January 2016 Links – Abhijit's World of .NET