To get the disclaimer out of the way first: I received a free NDepend Professional license for evaluation purposes, but that in no way influenced my opinion of the software. (Anyone who says otherwise shall be named Mike Arrington).
NDepend, a code analysis tool by Patrick Smacchia, is something I had always read about on popular .NET blogs, but never really paid much attention to. Mostly due to the fact that my projects were all small and noncommercial, so I didn’t think much about using something so detailed as NDepend. To be honest, my projects are still small and noncommercial, but I promised a long time ago that I would try it out and blog about it.
The first thing I noticed was that there’s no installer. I had to extract the ZIP to Program Files and add Start Menu shortcuts myself. That wasn’t a major problem, but it still would have been nice to have an installer. Especially with a commercial application.
Getting started was really easy. You can pick assemblies to analyze and NDepend opens a nicely formatted HTML report with more information than I could probably ever use (which is a good thing). All of that information also appears in the NDepend application itself. The charts are interactive and make it extremely easy to jump to classes, methods, interfaces, etc. I really like the Dependency Graph, because I always worry about which libraries I need to include during deployment. The Dependency Matrix is cool, as well, although a little tough to decipher at first glance. The rotated tree view is also a little difficult to get used to, but obviously necessary.
CQL queries are a major part of NDepend. They work a lot like rules in FxCop and allow you define rules using SQL syntax. The application comes pre-loaded with a ton of CQL queries and also includes a nice editor for writing your own. Aside from using them to enforce rules, you can also write CQL queries to retrieve useful information about your assembly.
I couldn’t come up with a suitable custom CQL query for my small test project, but I’ve looked at a lot of the pre-loaded queries and can definitely see where they would come in handy on larger projects. If you already know SQL, then you’ll be able to write CQL in no time.
The bottom line: If you’re working on a fairly large and complex project, or want to use something other than FxCop to enforce coding rules, then you should definitely give NDepend a shot. My only complaint is that there’s no installer.
I spoke further about NDepend’s installer-less distribution with Patrick Smacchia, who had this to say:
Concerning the installer we prefer it this way, just to show that we are not gonna tweak the registry in any way; a developer should be able to unzip a file + create its shortcuts very quickly.
He’s also posted a very nice explanation on his blog. Everything he says is completely valid and I’d like to point out that I don’t view the lack of an installer as a deal breaker in any way, shape, or form. It’s a convenience that would be nice, but not necessary. It’s safe to assume that developers know how to unzip a program and create shortcuts.
The reason I stated it was a “complaint” was because I only use one development machine and don’t have a need for portability in my programming tools, so I enjoy allowing an installer to set everything up. That’s obviously not the case for everyone and most likely just shows my laziness.