Saturday, May 10, 2014

nDepend - the code analysis super tool

Patrick from nDepend kindly sent me over a copy of nDepend to try out.

nDepend is a code coverage tool with a hell of a lot to give. Think of it like FxCop / Visual Studio's Analysis tools but with a whole suite of tools to support the analysis.

It's a great fit if you're looking to refactor your code, it can analyse it for problem areas (similar to FxCop) but it also has the capability to define your own metrics using "Code Query over Linq" (clever stuff indeed).

One of my favourite features is the ability to get a grasp of existing architecture, as we all know that even though your team's documentation should of been written early on, it often becomes a low priority as soon as it hits production.

It's also a nice way to explore open source projects and to take a look at the architecture the big players are using.

Here is an example of examining the popular open source .net CMS DNN (previously DotNetNuke), we can see highlighted that the method 'RewriteUrl' is perhaps overly complicated. Clicking the function name opens visual studio directly with the file open in the right place (nicely polished - it even has Visual Studio integration). Reading over the RewriteUrl method it's a bit of a beast and could become a maintenance problem so could be a future task to refactor (for example).

The screenshot may look complex as it's a power user tool, but nDepend is a very friendly tool offering contextual help along the way. A short blog post can't do it justice, if you're dabbling with refactoring and want something more powerful than the built in tools, I'd recommend taking a look at the nDepend website to learn more.



No comments: