Visual Studio Code Metrics & Refactoring

Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior.”  Martin Fowler

Using Code Metrics feature of Visual Studio (or Code Metrics Power Tools if you don’t have Premium or Ultimate edition) you can get some good information about which unit of code or components are candidates for refactoring.

Use this tool regularly in order to track refactoring opportunities. Check this MSDN article and this Post for usage.

Some metric hints you could use:

  1. Maintainability Index (< 40 or instance)
  2. Cyclomatic Complexity (> 15)
  3. Make a Top Ten Ranking of Refactoring Candidates by using: [Cyclomatic Complexity] * [LOC (Line of Code)] => Order By Desc

For valid ranges, check this Post.

PS: I will be working on how to get this metrics into a TFS Team Project Report.

Published Saturday, February 25, 2012 10:06 PM by javarg

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required)