Monday, May 18, 2009

NDepend - Code Anaysis Tool

Static code analyzers simplifies the management of a complex .NET code base. Code analyzers help architects and developers analyze code structure, specify design rules, plan massive refactoring, do effective code reviews and compare different versions of the code. The result is better communication, improved quality, easier maintenance and faster development.

Last week Patrick Smacchia, a C# MVP offererd me a pro license of NDepend to use the tool and buzz it on my blog if I find it useful. Thanks Patrick for introducing me to a great tool.

Compared to the existing code anlaysis tool NDepend has some unique feature that help you anlayze every aspect of your code and produces informative reports with detailed matrices, diagrams and charts that should help you improve your code. You can download and use a free trial version of NDepend from this link.

Some of the features that are unique and very useful are

Code Metrics Statistics - NDepend provides a full list of Code Metrics that let you analyze your developed application in a moment.

CQL - Support for Code Query Language (CQL) is really great. It helps display some information related to a specific matrix or set of matrices. CQL will help you answer in seconds your questions about your code base: Eg:

- Which public methods have more than 30 lines of code?

SELECT METHODS WHERE NbLinesOfCode > 30 AND IsPublic

- Which classes implement System.IDisposable?

SELECT TYPES WHERE IsClass AND Implements "System.IDisposable"

- Which methods have been refactored recently and is not thoroughly covered by tests?

SELECT METHODS WHERE CodeWasChanged AND PercentageCoverage < 100

Assemblies Abstractness vs. Instability Diagram: This diagram simply compares instability of a project with its abstractness.diagram helps you see the dependency between your project and different .NET assemblies.

Integration: NDepend integrates well with Visual Studio and Reflector. This helps me to get a anaysis at development time also.

No comments: