How does NDepend help me have a better understanding and control over my .NET code?

How does NDepend help me have a better understanding and control over my .NET code?

NDepend analyses .NET assemblies of an application and generates reports containing design quality metrics, warnings and diagrams. More on reports in the Sample Reports section.

The VisualNDepend tool allows analysing all these data thanks to an interactive view. Such view can be tuned according to numerous software metrics. Here are some screenshots of VisualNDepend. The sample analyzed application is the 15 main assemblies of the .NET Framework 2.0 (2.8M IL instructions):

 

NDepend 2.0 supports the Code Query Language (CQL) (1.0 specification available here). Basically, NDepend considers your code as a database and CQL allows to query and check some assertions on this database. As a consequence, CQL is similar to SQL and support the SELECT TOP FROM WHERE ORDER BY pattern. Here are some sample CQL queries and constraints:

WARN IF Count > 0 IN SELECT METHODS 
WHERE NbILInstructions > 200 ORDER BY NbILInstructions DESC
// METHODS WHERE NbILInstructions > 200 are extremely complex and            
// should be split in smaller methods.


WARN IF Count > 0 IN SELECT FIELDS WHERE NameLike "^m_" AND IsStatic         
// A static field should not be named 'm_XXX'.


WARN IF Count > 0 IN SELECT TYPES OUT OF NAMESPACES "System.Xml"
WHERE DepthOfIsUsing "System.Xml.XmlChildNodes" == 1
// Restrict the possibility to use the type "System.Xml.XmlChildNodes"       
// only to certain namespace.


SELECT TYPES WHERE DepthOfDeriveFrom "System.Windows.Forms.Control" == 1     
// Select classes which derive directly from control.


SELECT TOP 10 TYPES WHERE IsStructure ORDER BY NbILInstructions DESC         


Writing CQL queries and constraints is straightforward both because it is a SQL-like langage and because VisualNDepend provides a CQL editor which supports intellisense and verbose compile error description.

NDepend provides facilities to be integrated into build scripts written with MSBuild or NAnt.

Getting Started

First download NDepend 2.0. Currently a 100% featured beta version is available for free.

Then read the Quick Start Tutorial.

A list of features is available here.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值