Geeks With Blogs
Lee Brandt's Blog You're only as smart as your last line of code

I finally got a chance to run NDepend against a code base I'd written and I gotta tell you, it was an eye opening experience.

First of all, I'd recommend spending some time reading about static code metrics first. Patrick Cauldwell's book is a good resource to start with. He has a chapter about static code analysis and he explains it at a high level in a very simple way. The NDepend website also has some excellent resources on understanding your NDepend analysis output. they have screen casts, which make it easier to get up to speed faster if you're like me and don't read very fast. :) Wikipedia has this page that defines some of the metrics you might encounter when doing static code analysis.

Next just pick a chunk of code you've written and run it. If you find your code in the "Zone of Uselessness", don't be discouraged. Running static code analysis can be painful, but it will only serve to help you write better code later. when you see your coupling getting looser, but your cohesion is dropping, you'll start to get a better feel for what kinds of designs offer the best balance.

Overall NDepend is easy to use, but might be painful to see, when you get your results. Just remember: in software development,  ignorance is not bliss; it's deadly. The more you know about the problems in your code, the better your code will be. Also remember that software development is about choices. You may sometimes choose to leave some things more tightly coupled in order to make the software easier to extend & maintain. NDepend is a tool that can help you INTELLIGENTLY make those choices.


Posted on Sunday, September 7, 2008 4:29 PM | Back to top

Comments on this post: NDepend or My Code Uncovered

# re: NDepend or My Code Uncovered
Requesting Gravatar...
NDepend is a great tool for learning about issues you may not even know about in your code. I have a post coming sometime about it as well. Thanks for the links!
Left by Robz on Sep 07, 2008 8:41 PM

Your comment:
 (will show your gravatar)

Copyright © Lee Brandt | Powered by: