If you haven't taken a look at NDepend, you ought to.

Published Sun, Oct 21 2007 13:58 | William

Fellow MVP Patrick Smacchia created a product called NDepend.  It's been around for a while and I've used it on and off but recently started playing with it again.  It's pretty well known and has been mentioned in MSDN Magazine for one.  In short, NDepend is a tool you can use to analyze code.  In many ways, it reminds me of FXCop but it's certainly got a much broader focus and the metrics that come out of the box are really impressive.

 

To start with, you can point it to an assembly or group of assemblies.  Afterward, you hit OK and just sit back and see what it finds.  For the sake of discussion, I tried two different assemblies first. One that I wrote recently that I was particularly proud of and one from 4-5 years ago that I am embarrassed to say I wrote.  The results were exactly as I expected.  The one I wrote a while ago had several problems and the problems were all over the place.  My newer assembly didn't exactly come out perfect, but it had a really small set of problems and to be honest, most of them were things I didn't particularly like when I wrote it, but were tradeoffs I intentionally made.

There's a pretty good bit of support and demos on the site and there are some pretty helpful links within the product itself explaining the reasoning behind some of the alerts.  Here's a pretty solid demo of them.

To me, there are two things that determine the quality of a code analysis tool.  1- Does it find everything that's really wrong 2- Does it keep false positives to a minimum.  The first one is hard to really discern b/c in order to judge such a thing, you'd have to honestly know what all the problems were.  The less experienced you are (hence, more likely to make such mistakes) the less likely you are to know something is wrong. As far as detecting false positives, even that can be hard b/c you may not consider something a problem b/c of personal biases - but they still may be problems. Until you get familiar with FXCop, having it find things that you don't consider problematic is pretty common. Fortunately you can just ignore many of them.

The UI is pretty interesting. It's rather unique in that each method or class member is represented by a block and when you mouse over it, it changes its display and then all the information windows populate themselves.  It's different but it definitely works.  So you mouseover a member and it tells you how many lines of code, IL instructions and many more things comprise it.

The only feature I haven't really gotten to dig into is the CQL Query support. It looks quite intriguing but I just haven't had a chance to dig into it yet.

Well, I'll be posting more throughout the week b/c I've really gotten to love NDepend and have been using it more and more lately.  If you haven't checked it out, I would definitely recommend taking a look at it:  NDepend

Comments

# Jason Haley said on October 22, 2007 9:03 AM:

Search

This Blog

Tags

Community

Archives

News

My other sites

Cool Stuff

Book Stuff

Security

ORM

Data Access

Funny Stuff

Compact Framework Stuff

Web Casts

My KnowledgeBase Articles

My MVP Profile

Design Patterns

Performance

Debugging

Remoting

My Fellow Authors

My Books

LINQ

Misc

Speech

Syndication

Email Notifications