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 analyze of our code. The same is primary functionality of the NDepend software. Ok, so I have bunch of software files for Visual Studio from HopfiledSimulator solution and new, fresh version of NDepend only for me ;), so I can measure all metric of my open source project and make it better. Let’s see how it can to 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 projects. But there are only installation/setup projects without any C# code, so I can forget about that right now in my 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 found something interesting for me I wonder… ;), It found and give me a two things, first was window with results and second was 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 report? 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 code it is not in bad condition, but it can be much better because of 38 warnings. I was wonder how to fix warnings, so I opened menu to find what is wrong and found 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 feeling that this report can be automatically produced and send to my 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 fist try. As you can see an amount of information in report is very rich. 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 console application included to 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 calculation of metrics of code have very good real value in Software Quality of any produced applications.