Deep Code Analysis With NDepend

November 7, 2008

Deep Code Analysis With NDepend

A few weeks ago,NDepend
I was contacted by
Patrick Smacchia,
a C# MVP, that I 
read his articles on
one of my favorite
blog sites – CodeBetter.
Patrick asked me if I want to evaluate NDepend professional edition.
Without thinking twice, I agreed and this post is a review of the product.
I want to thank Patrick for the opportunity to evaluate a professional product
which I wanted to test for a while (I downloaded the evaluation edition a few
weeks before Patrick contact me and now I had the opportunity to download
the professional edition).

What is NDepend?

From NDepend site:
NDepend is a tool that simplifies managing a complex .NET code base. Architects and
developers can analyze code structure, specify design rules, plan massive refactoring,
do effective code reviews and master evolution by comparing different versions of the

The result is better communication, improved quality, easier maintenance and
faster development.”

NDepend is a great tool!
It is a static analyzer for a compiled code. It is suited for developers and architects
that want to analyze the written code and get very helpful output data.
The output data that NDepend produces can help to improve the
code quality and design. At first, I thought That the tool resembles the FxCop tool
but as I tested it further, I now understand that it allows me to drill down better and
deeper into my code and also it supplies a visual analysis that is more intuitive for me.

NDepend Features

NDepend has the following features:

I can tell that the most awesome feature is the CQL (Code Query
Language) which enables to write SQL like queries to get reflection details.
In FxCop to do the same thing enforces you to write rules or plug-ins which are less
intuitive then the CQL.

Documentation, Documentation, Documentation

The most helpful thing about NDepend is its documentation. Sometimes, when I
download a tool or a product, I wish that it’ll be documented properly. Most of the
tools aren’t documented at all or have a minor documentation. This issue is very
annoying because you pay a lot of money for tools and you expect that it will have
a decent documentation. The NDepend site is full of documentation and screen
casts that help to get start with the tool very fast.

Some Small Examples

When NDepend load you get the following startup page:
NDepend Start Page

As you can see, the tool can be integrated into Visual Studio (2005, 2008)
and also into reflector (which is a must have tool for a developers).

I used the New Project button from the File menu to build a new analysis project:
NDepend New Project View

You can now Browse or Drag & Drop assemblies to be analyzed.

After I dragged a simple assembly I got the following results:
NDepend At Action 

What you can see in the screen are Dependency Graph, Dependency Matrix
and the Metrics View which is set to the number of code lines in my example.
In the bottom are the CQL Queries View which enables the use of CQL to
inspect the code. This is only a minor assembly and NDepend gave me a lot of details
that I used to refactor the assembly and now the code is better written.


NDepend is a highly professional product. With its variety of features it can
supply a very deep analysis to the code you write. I only scratched the surface of
the product in this review.
One last important thing, I wasn’t paid or obligated to write this review and its my thoughts
only. I think a tool like NDepend can really help you to get a deep insight and perspective
on how you build your application and then help you to improve your code.

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>



  1. Rotem BloomNovember 9, 2008 ב 1:41

    Hi Gil,
    What I don’t see on your review, is how NDepend affects on the load of Visual Studio solutions. Resharper tool for example known as it slow the load of visual studio solutions, especially big ones. What is the case when using NDepend.
    Thanks Rotem.

  2. Gil FinkNovember 9, 2008 ב 3:24

    Hi Rotem,
    NDepend is a static analyzer tool. You run it on your compiled code to get its information. It comes as a stand alone program – Visual NDepend and it has integration into VS. It doesn’t affect the load of VS solutions like Resharper. Resharper runs in the background and gives you suggestions in realtime whereas NDepend is running when you decide to run it and gives you a lot of valuable information about your code. From its analysis you can detect dependency cycles, test coverage data, compare builds and more.

  3. Rotem BloomNovember 9, 2008 ב 8:47

    OK Gil thanks for the clarification.