Saturday, May 04, 2013

Analayze your code with Ndepend

Ndepend is a static code analyzer  for .NET projects. It performs analysis of the project codebase;  and provides metrics, graphs and reports ; all of which helps a developer to enhance the code quality. I would like to  thank Patrick , for developing it, and also for providing a licence to me.

Post code analysis, Ndepend provides several tools to better your code . 

1) Dependency Graph - As the name implies, the graph  displays the caller and the callee in the project. This is important as it provides a birds eye view , when the code base is large.

2) Queries and Rules explorer - This is an amazing tool , which displays areas where the code needs improvement. The explorer addresses several sections - architecture, design considerations, dead code etc . I am providing a snapshot below :-

Once a rule is selected ; the query and rules editor automatically creates a CQLinq syntax , executes the query and displays the result. Alliteratively , the developer can also write a query ( for those not covered by Ndepend ) and get respective results.

3) Metrics - The Metrics window displays the usage and relevance of the code being analyzed.  The developer can use the metrics, to view where are the methods being called directly or indirectly. Besides methods, developers can also view metrics of namespaces , fields  ; which come in very handy to understand calling sequences and workflow in large projects.

4) Dependency Matrix - The dependency matrix is a visual representation of the methods being used, and the methods using them . I am posting a screenshot below .

The following is the representation of the green and blue colour .

The Matrix Cell is Green because the method (in column) is used by the method (in row). 

The Matrix Cell is Blue because the method (in column) is using the method (in row). 

More features can be found here.  Overall I find it a great tool ; I shall update this post once I come across new features.

No comments :