Disclaimer : My license for NDepend was provided for free by Patrick Smacchia at NDepend. The article below is based purely on my observations and the use of NDepend.
A Review of NDepend
I have know about NDepend since 2008-2009, but have never used a third party static analysis tool other than Visual Studio built in tools.
So lets get started and see what NDepend brings us. After downloading and installing NDepend, launching VisualNDepend.exe I got this screen. Note: NDepend is also integrated with VisualStudio, one can also launch it through the solution context.
There appear to be a big arrow in red that is animated and is calling for an action. By clicking on it I am able to navigate to a Visual Studio Solution that I wish to analyze.
Let me pick a WPF Prism Demo project I wrote last year to play around Prism.
After picking the solution I am given the option to include all the projects that I wish to analyze in the solution.
The analysis then just zips through and it opens a new html page for report on your browser.
And a window/dialog to guide us through the report in the VisualNDepend.
I have choosen to look at the dashboard from the dialog, lets see what NDepend finds for my demo project.
First thing I notice is I have 1 critical violation, if I dig deep into it I see that the name Bootstrapper is violating the rule of “Avoid having different types with same name”. All Prism applications require a bootstrapper, it is something that loads your IoC container modules. It is somewhat debatable if its a violation since it inherits from UnityBootstrapper, but I can understand why there is a conflict also, maybe one should have named it ProjectNameBootstrapper.
The next thing that I looked into is the Dependency Matrix. The dependency matrix looks a bit like an odd matrix of numbers, and each number signifies the coupling of the code.
One thing that I did find helpful is the dependency graph, it shows you how your projects are related to one another in a graph, as far as I can tell I have only scratch the surface of things, it can also dig into each method and find out what calls are made to what modules.
Summary
I have to say NDepend is a very powerful tool which allows one to write LINQ like queries called CQL, for customizing your own static code analysis. I also think that this tool is catered towards System Architects not your day to day coder, since the information that you can get using the tool is enormous. Maybe a lite version may help with day to day coder, mainly focusing on critical errors and violations, something that can even integrates into your unit test.