Sometime ago I have been asked by Patrick Smacchia to write short review of his tool – NDepend. I believe that most of you know this tool. It is a swiss army knife in scope of code analysis. Capacity of this tool is enormous. I wanted to fulfil this request in a professional way. So, I needed to learn how to use this tool before writing any word regarding it. And it was not so easy task. This tool has so many features and possibilities of customisation… After two months of using it I can say that still I am not so advanced user of it.
I will try to do my best…
Summary report – HTML
Main function of this application is code analysis. It can gather a lot of code metrics and combine them into different reports that will provide information about state of our application code. After just few clicks you will get basic report:
You will find there information regarding:
- application metrics
- quality gate summary
- rules summary.
Of course you can investigate each of those elements deeply. Then you will get more information about each of element:
The key benefit of HTML report is possibility of sharing it with other people. Then somebody else can analyse it also. Moreover you can combine NDepend with you CI environment and automatically generate new report with successful build.
Summary report – Visual Studio
The biggest fun starts after switching to Visual Studio. You will be able to generate similar report but here you can navigate to related fragment of code.
Then also each time NDepend will store present values and combine it with previous ones. So you will be able to monitor code quality changes during your development.
…is enormous. You will find a lot of rules and queries already configured after installation. You can use them but probably you would like to adjust them to your style of writing code or to code guidelines from your project. And of course you can do that. At the beginning it will take most of your time. It is not so easy to do because of tool capacities. The easiest part is disabling some rules. But this is only start. You can also write your own rules and queries. In NDepend you will be using CQLinq.
But when your customisation of NDepend will be done… It will help you with your daily tasks. I like to use it for code review. Of course it will not substitute other developer but it can find some typical errors that are sometimes missed.
At the end I would like to mention feature that I like the most. It is dependencies analysis. With this tool you can check different connections / relations between elements in your code:
- dependency graph
- inheritance graph
- usage graph
Those simple diagrams can save a lot of time when you are starting to work with new application. Maybe one thing could be done better. I do not know how you can change configuration to use new window for showing another graph. Right now application is using always the same window.
It is hard to describe all features of NDepend in one post and I do not want to create manual for this app in this post. I encourage you to watch video that will present this application:
Definitely we can name this application as a swiss knife for code analysis. It comes with enormous number of features. And this is only the beginning. You can add new features – rules and queries – by using CQLinq. After that NDepend will suit perfectly to your needs.
Then also this is not that kind of tool that you will love from the first usage. You need to invest some time and get used to it. I was a bit afraid and lost when I run NDepend for the first time. Then I watched some videos, read some articles and adjusted it to my needs. And I managed to survive first days.
Definitely it is not so easy tool. And also this is not the tool for that kind of people that expect that one button that will do everything for them. You need to work with it a bit and then you will probably like it as I do.
And maybe two small things and the end. First of all I was quite surprised when I realized that you need to install NDepend manually. I would recommend adding installer to this tool.
Second thing is beginner mode. I would recommend adding one button mode – few most important features that are the best for the start.