What is NDepend?
This article is part one of a two part series about one of the most practical and dynamic tools in existence for .NET development. I’m talking about NDepend http://www.NDepend.com. I was approached about writing a review for NDepend so I downloaded the application to give it a try. As with all of my reviews, let it be known that if I think a product is mediocre, then that’s what I’m going to write. All that to say that this is no exaggeration, I really feel this strongly about this tool. I’m sure by the end of this article, I will have peeked your interest too. If you are interested, please read on.
NDepend pro product suite
From NDepend.com, “NDepend is a Visual Studio tool to manage complex .NET code and achieve high Code Quality.” This tool allows you to visualize your source code in many different ways in an effort to analyze the quality of your code and how to improve it. The product comes complete with a Visual Studio add in, an independent GUI tool, and a set of power tools that are console based which makes the product suite extremely versatile. Whether you are pressed for time and need to analyze your code while in visual studio, you prefer a standalone GUI, or you are addicted to the command line, this product is made to fit your needs.
The NDpend installation process is very straight forward. The download is a zip file that contains the complete product suite. You simply pick a folder to install to and unzip the archive. If you’ve purchased the pro version, you will be provided with a license in the form of an XML file which needs to be placed in the directory that you chose to install the product.
Installing the Visual Studio 2012 add-in
Once you’ve unzipped the archive, you need to run the NDepend.Install.VisualStudioAddin.exe executable to install the Visual Studio add-in.
Running the install
The installation completed
Adding an NDepend project to your solution
When you use the Visual Studio integration, you need to create an NDepend project in the solution that you wish to analyze.
NDepend will tell you anything that wish you know about source code. This is powerful, however, it’s a point that must be covered. In order to be productive with NDepend, you must first define what information that you wish to discover about your source code and how you plan to use that information. If you don’t have this information then you will not get much use from the product. The information that it provides to you is very useful, however, you must take some time to plan out how you will use this information to benefit you and your coding efforts.
You may wish to make sure that your code maintains a consistent amount of test coverage. Perhaps you wish to make sure that all methods in your codebase stay below a certain threshold regarding the number of lines of code that they contain. NDepend is capable of telling you this and much more about your source code.
One of the coolest features that I’ve seen in the product is the Code Query Linq (CQLinqing). This allows you to query your source code using LINQ syntax to bring back anything that you wish to know about your source code. You can query an assembly, a class, even a method. The product comes with predefined CQLinq rules but also allows you to create your own rules as well as edit existing rules.
I plan to write another blog post that explains my personal experience with the product. I’ve recently joined an open source project that is a framework that handles some very advanced topics such Artificial intelligence, Machine learning, and language design. The project is called neural network designer http://bragisoft.com/ . I chose this project because the source code is vast and I believe that a large code base is a perfect target to use NDepend to get the most benefit.
I plan to use the product and test the following areas:
What information do I want to know about my code base?
When do I wish to be presented with this information?
How do I plan on using this information to improve my code?
How can I use NDepend to provide this information?
I think that if you wish to get any use out of the product, it will be very important that you answer these questions. The product is vast and diverse but it can also be a bit intimidating. With that said, I plan to use my next post to illustrate how I was able to use NDepend to define the metrics that I needed from my code, and how I used NDepend to provide those metrics to me.
Stay tuned for the next installment which will explain my experience with using NDepend to improve my development efforts and my source code.
Thanks for reading,