Title: Review: NDepend
Slug: review-ndepend
Date: 2008-09-27 02:35:00
Author: Kartones
Lang: en
Tags: Tools, .NET, App Reviews
Description: A review of the .NET tool NDepend.

 <p>For this application review, I've chosen a proof of concept I built last year, a small dungeon generator for RPGs (just places rooms and intersecting corridors, don't think I did anything exceptional ;)<br>The code needs refactoring (or probably starting from a clean project to better apply design patterns as a Factory), it was made in two nights and it even lacks documentation in all non-vital areas. But it had some unit tests and a "console renderer" to see the results:</p> <p><img src="https://images.kartones.net/posts/screenshots/gr_001.jpg" mce_src="https://images.kartones.net/posts/screenshots/gr_001.jpg"> </p> <p>So, although quite small in code (1.900 lines of code containing unit tests &amp; comments) it is a good candidate for testing <a href="http://www.ndepend.com/">NDepend</a>.</p> <p><img src="https://images.kartones.net/posts/screenshots/ndepend_001.jpg" mce_src="https://images.kartones.net/posts/screenshots/ndepend_001.jpg"> </p> <p>What is NDepend? Simply said, is the heavy artillery for .NET analysts and architects.</p> <p>You need to check your code's complexity? You will get every available aspect, from methods' nesting depth, to <a href="http://en.wikipedia.org/wiki/Cyclomatic_complexity">cyclomatic complexity</a> to missing comments in large blocks of code.</p> <p><img src="https://images.kartones.net/posts/screenshots/ndepend_003.jpg" mce_src="https://images.kartones.net/posts/screenshots/ndepend_003.jpg"> </p> <p>You need to change an assembly and want to know how the application will be affected and where to change the references and calls? You can check from simple graphs:</p> <p><img src="https://images.kartones.net/posts/screenshots/ndepend_004.png" mce_src="https://images.kartones.net/posts/screenshots/ndepend_004.png"> </p> <p>To a full dependency matrix:</p> <p><img src="https://images.kartones.net/posts/screenshots/ndepend_002.jpg" mce_src="https://images.kartones.net/posts/screenshots/ndepend_002.jpg"> </p> <p>You will get quite big HTML reports detailing everything, easily readable and very very detailed. They contain even the <a href="http://www.ndepend.com/Features.aspx#CQL">CQL</a>'s querys launched against your application.</p> <p>CQL is a SQL-like language thats allows to create custom or advanced code analysis. You can check some examples of custom made CQL querys in the <a href="http://codebetter.com/blogs/patricksmacchia/archive/2008/08/05/rules-for-spartan-programmers.aspx">Rules for Spartan Programmers post</a>.</p> <p>NDepend allows too to compare two versions of assemblies, once again generating highly detailed reports. To see an example check the <a href="http://codebetter.com/blogs/patricksmacchia/archive/2008/08/13/net-3-5-sp1-changes-overview.aspx">.NET 3.5 SP1 changes overview post</a>.</p> <p> </p> <p>The application integratesperfectly into Visual Studio, via the context menu:</p> <p><img src="https://images.kartones.net/posts/screenshots/ndepend_005.jpg" mce_src="https://images.kartones.net/posts/screenshots/ndepend_005.jpg"> </p> <p>We have available some flash movie tutorials to learn how to perform all tasks in few minutes, there are new revisions/builds of the application often... </p> <p> </p> <p>I've just started using NDepend, and I feel like it should be mandatory for architects, like FXCop. </p> <p>Any project can benefit from it. My dungeon generator application needs things like refactoring (methods with too many input parameters or too many lines of code inside, unsealed classes, possible conversions to structures...</p> <p> </p> <p>Many thanks to <a href="http://codebetter.com/patricksmacchia/">Patrick Smacchia</a> for providing me a Professional license of NDepend.</p>
