NDepend v4 has finally arrived

Posted by Filip Ekberg on 31 May 2012

It is truly a great pleasure to finally be able to spread the word about NDepend version 4. For those of you that do not know what NDepend is, you have truly missed out on something great. But not to worry, you can catch up in an instant!

NDepend is a complexity analysis tool that integrates into Visual Studio 2011, 2010 and 2008. It also comes with a standalone component for analyzing your projects.

I have been using NDepend v4 for a while now and I liked it so much that it gets a place in my upcoming book.

What makes NDepend so powerful is that you can customize the analysis to adapt to your own set of restrictions and you do this with what is called Code Query LINQ(CQLinq). This is one of the biggest changes in version 4 and it really takes the tool to another level, prior to version 4 you used another way to customize your queries.

Here is an example(example taken from NDepend Features page) of a CQLinq statement that looks for methods that do not have enough comments:

from m in Application.Methods 
where m.CyclomaticComplexity >  15 && m.PercentageComment <  10
select new { m, m.CyclomaticComplexity, m.PercentageComment }

I made an analyze of the ASP.NET Web Stack project and this is what the report look like in the stand alone program called Visual NDepend:

In the image above it shows the dependency graph you have a lot of other views that you can use to find complexity in your solution. You can also see a list of the different CQLinq results such as:

  • Types that are too big
  • Methods that are too complex
  • Methods that takes too many parameters

When composing this analysis you also get an HTML Report that looks like this:

It essentially contains the same information as you would get from Visual NDepend, but it is very handy to be able to pass this report on to fellow co-workers.

Another Very powerful thing is that you can integrate NDepend with for instance CruiseControl.NET, which is a build server. This means that every time the build server builds your project, it can also analyze the solution and compare how your complexity increases or decreases.

You can get a 14 day trial, I really suggest you do, you do not want to miss out on this! There will also be much more content regarding NDepend in the book I am currently writing, stay tuned for more information about that.

comments powered by Disqus