Deep Code Analysis With NDepend
Deep Code Analysis With NDepend
A few weeks ago,
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
code.
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:
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:
You can now Browse or Drag & Drop assemblies to be analyzed.
After I dragged a simple assembly I got the following results:
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.
Summary
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.