Monday, December 7, 2009

NDepend

I've started using NDepend Pro on my open-source project. I will try to outline some important features and explain some ideas that differenciate this tool from others like FXCop or ReSharper rules.

What is NDepend?

For me NDepend is a tool for monitoring and improving code quality. It uses software metrics and .NET IL characteristics to help us understand, analyze, visualize and compare different code bases and builds. We learnt code coverage, cohesion, coupling and other code metrics at university, but we hardly had the chance to employ this knowledge (or even understand deeper them). Who wants to calculate them for hundreds of code lines? Well, NDepend just does it instead of us. We can see the internals of code structure and dependencies with just one click!

Costs

NDepend is a free tool for academic and open-source projects. Unfortunately it comes with a cost: you will be restricted with CQL (creating custom code metrics queries) usage, won’t be able to compare builds, won’t be able to integrate test metrics into the dataset and (almost) won’t have Visual Studio integration. I think it’s OK for an open-source project.

Where to start?

NDepend is not an easy tool. Easy to use, but it takes time to learn and understand the metrics and find the proper threshold limits for your project. NDepend team knows it, so they set up a lot of preset thresholds and built-in CQL queries. There are useful demo videos and there is a metrics library. So it’s easy to start using it.

How do I use it?

I use NDepend as a guard. I use other tools (like Resharper, Team System Tools or FXCop) in Visual Studio to check against naming conventions and some other rules. Visual NDepend helps me to understand the structure of my application and recheck some rules, mainly with built-in CQL queries.

I found a circular call in one of my assemblies. It was not trivial to me, I couldn’t have found that without NDepend.

Link: NDepend
Link: software metrics
Link: Inheritance Depth in CQL

No comments:

Post a Comment