“Zone of Pain vs. Zone of Uselessness” or code analysis with NDepend
As for me, there are only two kinds of projects – hobbyist’s nifty tools and systems (scale may wary). The main difference between those is the easiness of making changes and refactoring. Other words, how many other developers I should persuade to do it just because “In the final analysis, it’s their war” – JFK. But what can be the good reason for such fast talk? – “You code sucks or at least it ought to”.

“Every generation needs a new revolution” – Thomas Jefferson
So, in order to win such revolution for “systems” you absolutely need static analysis tools like NDepend. Those tools are not intended for being your advocates, but those intended to help you to understand all risks and approximate the amount of work should be done to fulfill another revolution.
Unfortunately, you cannot use such tools for fair measuring of code quality because of Computer Science rules of thumb. How to decide whether “methods is too big” or “method is too complex”? However you can (and should) use it for dependencies risk detection. For example, in following illustration you can clear understand that any change inside BetterPlace.Core or BetterPlace.Model assemblies (and namespaces) can be painful.
Now the only question is who is responsible of modules, using it and how long will it take to convince them to make a revolution.
From here you can start using CQL (Code Query Language) which is SQL like language invented by Patrick, the author of NDepend, for querying code elements and sections. By using it, you can define what “method is too big” means in terms of your project.
SELECT METHODS WHERE NbLinesOfCode > 300 ORDER BY NbLinesOfCode DESC
Or see where you should replace method overloads by default arguments, introduced in .NET 4.0
SELECT METHODS WHERE NbOverloads > 1 ORDER BY NbOverloads DESC
Then, when you marked all places and human targets for revolution, you can start it. After you done, you can even compare builds and measure the amount of work and quality of results achieved.
To finalize, I just touched the tip of what good static analysis tool can be used for. So get it, learn it and use it not only when you need to make a revolutions, but also during your application design and build process to be aware about how the new monster created will looks like.
Download NDepend >>
Proper disclosure: Apr 15, Patrick, the author of NDepend, asked me to review his tool and offer one license for evaluation. I told him, that do not need to evaluate it because I’m using it for a while (also I had the license of my own) and I’ll be happy to write a review once I’ll have a bit time for it. Now it happened. Thank you, Patrick, for such good work!
July 27th, 2009 · Comments (2)
2 Responses to ““Zone of Pain vs. Zone of Uselessness” or code analysis with NDepend”
Leave a Reply
Discover other tags
My tools
- .NET Framework Detector
- Duplicate images finder
- Exchange Security Policy for Windows Mobile Devices Fix
- Gas Price Windows Vista SideBar gadget
- Israel Traffic Information Windows Vista SideBar gadget
- Localization fix for SAP ES Explorer for Visual Studio
- LocTester
- RTL and LTR in Windows Live Writer
- Silverlight controls library
- Snipping tool integration plugin for WLW
- USB FM receiver library
- Vista Battery Saver
- WebCam control for WPF
- Windows Live SkyDrive attachment for Windows Live Writer
- Wireless Migrator
- WPF Virtual Keyboard





December 21st, 2010 at 8:22 pm
In relation to security programs, especially for companies, I need to concur with what you’ve said completely. You will discover so several options in the marketplace, it’s crucial for any professional to be aware what is finestfor his or her scenario and as well as specific construction. The insights you’re giving can be a terrific aid to companies along with security experts alike. Many thanks once more!
February 24th, 2012 at 6:40 am
Excellent post. I was checking constantly this blog and I’m impressed! Extremely helpful information specially the last part
I care for such info a lot. I was seeking this particular information for a long time. Thank you and best of luck.