views:

207

answers:

2

I have done the code analysis for my project using VS2010.

Here is my results,

  1. Maintainability Index - 75%
  2. Cyclomatic Complexity - 213
  3. Depth of Inheritance - 7
  4. Class Coupling - 98
  5. Lines of Code - 747

can any body, please explain about my project health. is it doing good, bad or average? How can we interpret these results?

A: 

I don't think you can say much about the project based on those numbers right now. Different projects have different needs, a simple data entry app will have a different cyclomatic complexity than a 3d rendering library. Comparing these numbers between projects is like comparing apples and oranges.

There are two ways you can use these numbers.

  • Track them over time. If you see coupling going up you might want to start asking yourself some questions.
  • Compare different parts of your application. If some parts are more prone to bugs you can check to see what's causing this.

Just be sure you use these metrics to diagnose actual problems. Don't start inventing problems you're not having because 'depth of inheritance is way up'

Mendelt
yes. it's more about the quality of the code. Way of writing comments, Conditional statements and loops.Thanks!!!
Dinesh
A: 

I believe one thing you should keep in mind is that these numbers are not absolutes. Best case scenario you will be able to use the numbers as an indication of project health, but you need to apply a fair amount of common sense here.

When the feature was released with VS2008 I used it to analyze entries for a obfuscated C# challenge I ran at the time. The results were a bit surprising. All the entries were rated as good, maintainable code. Obviously the code was obfuscated and thus hard to read, understand and maintain.

To use the analysis, I would do the following. Notice the numbers and then go through the code (or samples of the code) to get an idea of the quality/maintainability. Following that you can run the analysis on a regular basis and use the deltas to indicate where problems may be starting to root.

Brian Rasmussen
It's true. I am looking into one by one function. Maintainability is really helping me to check the functions in terms of Comments and the way it was written. cyclomatic complexity told me about the loops and conditional statements inside that function.Thanks!!
Dinesh