An NDepth Look @ NDepend30 Oct 2008
I’ve been wanting to review NDepend for quite some time, but I figured it was bad form to run it against my production code from work.
So, instead of running the tool against my work code, I thought I’d use the PetShop ASP.NET MVC project that I created for the .NET User’s Group.
NDepend provides many ways to visualize the architecture of any particular project. To create the following pictures and diagrams all I did was point NDepend to my Visual Studio solution file.
A useful way to get an understanding of how your application architecture is to generate a Dependency Graph based off your code. The following graph shows show the PetShop pieces relate to one another.
<div>For those of you who are graphically challenged, there is a Dependency Matrix that does a nice job of showing how many dependencies there are between 2 particular areas of your design.</div>
<div>The next diagram has always impressed me. Even if you didn’t know what it meant… it is pretty impressive to just look at :) The following diagram is actually showing the Code Metrics for your project. The following image represents the number of lines of code (LOC) in your project. </div>
In addition to all these cool graphs, matrices, and images, there are some hard core queries that you can perform against your assemblies. NDepend has something called Code Query Language (CQL) that allows you to write custom queries to identify numerous statistics such as:
<ul><li>Which public methods have more than 30 lines of code?</li><li>Which classes implement System.IDisposable?</li><li>Which methods have been refactored recently and is not thoroughly covered by tests?</li><li>etc…
<div>The following is an example of what a CQL query looks like. This query identifies the methods that are too big in your assembly. NDepend comes with a library of already created queries, such as this one, but you are able to add to or customize these quieres as well. </div>
There is so many more features that I haven’t covered that NDepend provides, but I wanted to highlight some of the features that I thought are very useful and could help you in your current projects.
I think this tools adds some great functionality that dovetails nicely with the features of from the various Visual Studio suites.
Don’t just take my word for it, I encourage you to download a trial version of NDepend and check it out for yourself.
Then if you like it, make a list of the features that are useful for your project, show it to your boss, and see if your work will pay for it :)