NDepend

(archived from my old blog from my pre-MS days)

The first time I heard of NDepend was on Hanselminutes (show here).  It sounded intriguing, but at the same time the show went into a lot of detail and used a lot of terminology that I wasn't familiar with, even with a computer science degree.  So it was with a little trepidation that I downloaded a copy and ran it against an application that I was working on at the time. 

To be honest, a bit of information overload was involved.  I could see that NDepend had gathered a lot of statistics regarding the code base, but I had no idea how to use it.  I didn't look at NDepend again for a few months.

The next time I saw NDepend was when I was looking at CI-Factory last year.  It was included as one of the tools in the continuous integration mix.  Same experience - information overload.

Just last week or so I took one more look at NDepend to see if it could help out with the code base I had inherited at work.  I had many places that needed refactoring, but it was hard to tell where to start.  My initial (3-minutes) reaction was the same - too much information after the analysis was complete.  I didn't know where to start.  But this time I stuck it out for more than 5 minutes - and that was all it took for me to fall in love (this time) with NDepend.  NDepend is largely based on "CQL" (Code Query Language), that sorta-kinda looks like SQL, but goes against code instead of a database (hmm... "LINQ to code" can't be very far off).  NDepend has several canned CQL statements that it runs as part of the analysis to help identify coding faux-pas, and the first query, with the description of "Quick summary of methods to refactor" was a treasure-trove of bad juju.  It identified methods that were too big, too complex, too... just about anything that can be quickly called out, and it picked the worst offenders to show.

NDepend1

NDepend2

NDepend3

NDepend showed me where the worst code was first.  That's what I got for sticking it out this time.  Now there are many, many more features that I have hardly scratched the surface of, and I hope to be able to cover those in later blog posts.  For now, just try out https://www.ndepend.com and check out your own FBI-most-wanted list.