How to evalulate your code: "Calculate Code Metrics" in Visual Studio 2008

Posted by SunKwon Kim on 2009/01/20 11:38
Filed under .NET Framework
Tags :

Do you know What is "Calculate Code Metrics" as a new feature of Visual Studio 2008

User image
I have wanted to know how to evaluate my code easily. But It is not easy to buy the solution privately for that. :) Like preparing the exam into University, it helps to enhance our programming skill. Programming and rating it. And we can do it using Visual Studio 2008 easily.

InfoSys posted "Calculate Code Metrics Features in Visual Studio 2008"

It is a good post. It is easy to read and understand about "Calculate Code Metric". All the thing you have to for "Calculate Code Metric" are just two steps.
  1. Click Mouse right button on your Visual Studio Solution and select "Calculate Code Metrics".
  2. Read five indices, which means the followings

Meaning of the indices are explained in here. The summary of that is following.

Maintainability Index: This index tells how maintainable your code is. It is like a total score. Higher the value better your code is.
Cyclomatic Complexity: This index is calculated at a method level. and it tells how complex the relation between methods in your code is. So lower the value better your code is.
Depth of Inheritance: This tells the number of base classes. it is good to maintain the number of inheritance appropriately. Infosys recommended to keep this value to 6 or below
Class Coupling: This number shows the number of classes a particular class depends on. It is better to keep this value lower.
Lines of Code; It tells the number of lines except white space, comments, braces and so on. So it can shows your daily work.

It is easy, isn't it?

2009/01/20 11:38 2009/01/20 11:38