views:

530

answers:

2

Since yesterday, I am analyzing one of our project with Ndepend (free for most of its features) and more I am using it, and more I have doubt about the real value of this type of software (code-analysis software).

Let me explain, The system build a report about the health of the system and class by Rank every metric. I thought it would be a good starting point to do modifications but most of the top result are here because they have over 100 lines inside the class (we have big headers and we do use VS comments styles) so it's not a big deal... than the number of Afferent Coupling level (CA) is always too high and this is almost very true for Interface that we used a lot... so at this moment I do not see something wrong but NDepend seem to do not like it (if you have suggestion to improve that tell me because I do not see the need for). It's the samething for the metric called "NOC" for Number of children that most of my Interface are too high...

For the moment, the only very useful metric is the Cyclomatic Complexity...

My question is : Do you find is worth it to analyse code with Automatic Code Analyser like NDepend? If yes, how do you filter all information that I have mentionned that doesn't really show the real health of the system?

A: 

I don't necessarily see NDepend results as "good" or "bad" in software engineering, there's always a good reason why an application is designed the way it is. I see it as a report that can probably help me point out issues with my design, but I have the final word when it comes to deciding if a method needs to be refactored or if it's good the way I designed it. In general, don't get too caught up trying to answer if it's worth it or not. It definitely is, instead I would suggest you carefully review the results. This will help you view your design from another perspective and there may be occasions where you decide the way you designed it is the best to achieve your applications goals.

Ricardo Villamil
+1  A: 

Actually metrics are just one feature of NDepend, did you try to use VisualNDepend that lets you analyze your project much more in depth than the report? By reading your comment, I am almost sure you didn't play with VisualNDepend which is the best way to filter data about your code base.

I am one of the developers of NDepend and we use it a lot to analyze our own code. Basically we write our own quality rules with CQL (Code Query Language). These rules automatically make sure that we don't have regression on our design. I detailled all these in a blog post available here.

Here are some unique features of NDepend and not related to code metrics:

-Write CQL rules to make sure we don't have architectural flaws, such as dependency cycles between our components, UI using directly the DB or DB entangled with the business objects.

-Make sure we don't have problem with code coverage by tests (like we make sure with a CQL rule that if a class is supposed to be 100% covered, it will remain 100% covered in the future)

-Enforce side-effects-free code (immutable class/pure methods)

-Use the ability to compare 2 analysis to code review changes since the last release, before doing a new release. More specifically, I enjoy using NDepend to know which method has been added and refactored since the last release, and is not 100% covered by tests.

-Having an optimal encapsulation for all our members and types (like knowing which internal methods can be declared as private). This is also related to dead-code detection that NDepend also supports.

For a complete list of features if NDepend, see here.

Patrick Smacchia - NDepend dev
I have played a litte (2 hours) with the VisualNDepend. I am not telling the product is not well done, but let say the Matrix... alright I have my LOG module with a high Coupling.. it's normal.. than I see hight coupling between the Persistance Facade and BusinessObject... it's normal...
Daok
All those "normal" situation are hightligthed in NDepend (and other software with metric), are they really revelent? This is my question. +1 For your answer, I like to know opinion and personal experience but you haven't convict me of the use of tool like that yet ;)
Daok