Hi, about a week ago I received message from Patrick Smacchia about new version of NDepend, also He gave me Professional version of this amazing tool. I wonder what kind of interesting information I can get from NDepend. As you probably know at the end of the 2010 year I published on the CodePlex one mathematical open source project named HopfieldSimulator at http://hopfieldsimulator.codeplex.com/, this project has no warnings in both StyleCop and FxCop software. Both of missioned *Cop software are useful for static analysis of our code. The same is the primary functionality of the NDepend software. Ok, so I have a bunch of software files for Visual Studio from the HopfiledSimulator solution and a new, fresh version of NDepend only for me ;), so I can measure all metrics of my open-source project and make it better. Let’s see how it can be, but first things first.
Installation of the NDepend is very easy. First we need to download it from http://www.ndepend.com/NDependDownload.aspx web site, because I have a license key of professional version of NDepend I download it quickly in a ZIP file, I unpacked it and I copy to unpacked folder my license in NDependProLicense.xml file:
Installation is very easy because we need only run NDepend.Install.VisualStudioAddin.exe executable file and click on Install buttons.
Ok now we are ready for open HopfieldSimulator solution in Visual Studio, for example in new 2012 version ;). Unfortunately, Visual Studio 2012 does not recognize Hopfield.Setup\Hopfield.Setup.vdproj or any VDPROJ files, so I cannot load this project. But there are only installation/setup projects without any C# code, so I can forget that right now while playing with NDepend.
So, I am ready to lunch ‘NDepend->NDepend Project->New Project’ from menu of Visual Studio 2012.
OK, and after few seconds I add elements of my solution to the analyst from a few available projects of the HopfieldSimulator solution.
And I simply lunch green arrow, because I was very interesting what StyleCop and FxCop did not found. Maybe NDepend will find something interesting for me, I wonder… ;). It found and gave me two things, the first was a window with results, and the second was a report in a web browser.
As you can see my code was not as good as I knew before. There are many warnings. And what about web reports? It looks like this.
My code was checked by 92 build-in metrics, 38 of them have warring status and 0 of them have error status, ufff ;), not so bad. Of course, the code is not in bad condition, but it can be much better because of 38 warnings. I was wondering how to fix warnings, so I opened the menu to find what was wrong and found an interesting category.
I choose for example Code Quality and then Quick summary of method refactor results to see what exactly can be made better.
It is great because I can easily found with of my method needs to be refactored. Also, I have a feeling that this report can be automatically produced and sent to me on every build of my solution on Cruise Control .NET or Team City or on any Continues Integration solution 😉 I will check that next time.
As a conclusion I can say that this is a first brief description of in my opinion amazing tool which is NDepend, Today I simply show you how easy it can be for a first try. As you can see, the amount of information in the report is wealthy. Next time I will try to prepare my own statistics and show you how we can measure our code by custom metrics and run production of the report from the console application included in my Professional version of NDepend.
Also I think that NDepend has possibility to become the same in Software Engineering than Crawdad is in publications of any texts. Because the calculation of metrics of code has excellent value in the Software Quality of any produced applications.