a blog for those who code

Monday, 23 March 2015

NDepend - Dependency Analysis Tool

In this post we will discuss about a dependency analysis tool for .Net (NDepend). NDepend is a static code analysis tool that provides a lot of features to analyze your code with statistical information and diagrams. It is a Visual Studio plugin which performs a number of analysis across the solution.According to NDepend, it offers a wide range of features to let user analyze a code base. It is often described as a Swiss Army Knife for .Net developers. Before discussing about the NDepend tool we should all know that what exactly is a Static Code Analysis.

What is Static Code Analysis ?

It is a process of detecting errors and defects in software's source code. It is nothing but an automated code review process.It is also a technique that lets you analyze your code statically and it helps you to find places where you can improve your code. It even allows you to analyze the dependencies between different parts of the code.

The Features of NDepend are

1. Code Rule and Code Query
2. Trend Monitoring
3. Harness Test Coverage Data
4. Code Quality, 82 Code Metrics
5. Explore Existing Architecture
6. Detect Dependency Cycles
7. Compare Builds and Code Diff
8. Enforce Immutability and Purity
9. Complexity and Diagrams
10. Continuous Integration Reporting
11. Warning on Build Process Health
12. NDepend.API and Power Tools
13. Real World Proof

Why every .Net Developers should use NDepend ?

It helps us to get a lot of dependency related issues. We developers spend a lot of time in re-factoring our codes and usually forgets that a little change might break something, thus where NDepend comes handy.You can even examine your assemblies, types and methods, which helps you to keep a view whether coupling between these are out of hand. It has a fantastic query language which lets you to write custom queries.

Getting Started with NDepend 

When you open Visual Studio after installing the NDepend, you will get NDepend Tab. The NDepend Start Page looks like -

You will get a lot of option to choose from like New NDepend Project, Open NDepend Project, Analyze VS Solutions and VS Projects, Analyze .Net assemblies in directory, Analyze a set of .Net assemblies and Compare 2 versions of a code base.

Using this option you can Attach new NDepend Project to current VS Solution Or you can Attach existing NDepend project to current VS Solution.We are going to Analyze our Small Asp.Net Web Application solution. After clicking Attach new NDepend Project to current VS Solution we get the below option.Then Analyze a single .Net Assembly we get a number of options like below.

The dashboard will look like

We can even use CQ Linq Query to find out some of the Potential Dead Fields as mentioned in the reports. The query will look like

You just saw that how awesome is the NDepend tool, its a really great tool to do Static Analysis of .net Managed code.In this post I left behind so many other features of NDepend, you can check the useful feature by yourself. Visit NDepend for more information.

Please Like and Share the Blog, if you find it interesting and helpful.

No comments:

Post a Comment

Contact Us


Email *

Message *


CC License