Disclaimer: Sometime back I received a free licence for NDepend from Patrick Smacchia. Patrick contacted me for reviewing the latest version and did not express any expectation for a positive review.
According to NDepend’s website:
NDepend offers a wide range of features to let the user analyze a code base. It is often described as a Swiss Army Knife for .NET developers.
After spending a couple of hours with the NDepend as a new user, the statement seems to be quite relevant. For last few months, I have been part of a complex business application built by developers with different field of expertise i.e. SharePoint, C#, Linq to SQL to name a few. As a lead developer and architect, time and again I have felt the need of correct set of tools which can help me to understand and check the implementation if it follows the design and architecture envisioned. Lately, I have been using Visual Studio Ultimate for this purpose. With a whopping price tag of $13,299.00 (which is really difficult to convince your Manager to buy it for you), it does help you in some areas for e.g. creating dependency graphs, finding code clones etc. But, you still miss detailed metric which you can directly see and give your developers as a feedback.
Having said that, NDepend has been quite on mark as far as that need is concerned.
- I used one of the Business Layer assembly of a medium complexity project to analyse the NDepend’s dashboard. The result was phenomenal, resulting in various categories. For e.g. it clearly states the number of line of code (LoC) in my assembly and also out of which are not my code. The not my code basically excludes the code generates by Visual Studio or any other frameworks and usually in designer files. This is quite transparent information not only for the development team but also the stakeholders, client involved in the software.
- The dashboard as the name suggests is in fact one place for all the information I need on a day to day basis. It simply tells me how many types, assemblies, namespaces, methods etc have been used in the project. Is there an external or third party assembly being used? This is something you want to know without actually opening the Visual Studio project. Or I just know from the dashboard if there are any Code rules which have been violated in the project.
- Then you have queries and rules explorer. The left panel as shown in the image below basically tells you which rule sets have been violated or followed by assembly. The icons are quite standard and it’s quite clear what they mean. For example in the Architecture and Layering category, I can see there is one namespace with a dependency cycle or there are 10 instances where UI layer is actually calling the DAL layer. Now if I select and click on the left panel, NDepend would provide the detail information poiting out the places where the rule has been violated.
Of course, there are some places where I do not agree with NDepend as well. For e.g. the naming conventions. Every company or team has a different set of of naming standards and they are decided on various factors. However, good news is that I can turn off a group or a ruleset if I am not interested.
All in all, the first impression has been very positive. Let’s see if NDepend can be the tool which becomes part of artillery (they claim to be Swiss Knife for developers :)), as ReSharper did some time back.
€ 299 for every developer edition, is a good investment for a tool which helps you to analyse the quality of your code and product. At the same time, it’s a great learning tool. Eventually, the developers will stick to design principles and best practices resulting in a better product.