NDepend
Encyclopedia
NDepend is a static analysis
tool for .NET managed code. This tool supports a large number of code metrics, allows for visualization of dependencies using directed graph
s and dependency matrix
. The tools also performs code base snapshots comparison, and validation of architectural and quality rules. User-defined rules can be written using a dedicated language called "Code Query Language" (CQL). This language is very similar to SQL
, hence users can query the code base the same way that one would query a relational database
. The tool also comes with a large number of predefined code quality rules. Rules can be checked automatically during continuous integration
.
inspired query language: .NET assemblies can be queried in a very similar way that relational database are queried. For example:
- Which public methods have more than 30 lines of code?
SELECT METHODS WHERE NbLinesOfCode > 30 AND IsPublic
- Which classes implement System.IDisposable?
SELECT TYPES WHERE IsClass AND Implements "System.IDisposable"
- Which methods have been modified since the last release?
SELECT METHODS WHERE CodeWasChanged
Static code analysis
Static program analysis is the analysis of computer software that is performed without actually executing programs built from that software In most cases the analysis is performed on some version of the source code and in the other cases some form of the object code...
tool for .NET managed code. This tool supports a large number of code metrics, allows for visualization of dependencies using directed graph
Directed graph
A directed graph or digraph is a pair G= of:* a set V, whose elements are called vertices or nodes,...
s and dependency matrix
Design Structure Matrix
The design structure matrix is a compact, matrix representation of a system or project...
. The tools also performs code base snapshots comparison, and validation of architectural and quality rules. User-defined rules can be written using a dedicated language called "Code Query Language" (CQL). This language is very similar to SQL
SQL
SQL is a programming language designed for managing data in relational database management systems ....
, hence users can query the code base the same way that one would query a relational database
Relational database
A relational database is a database that conforms to relational model theory. The software used in a relational database is called a relational database management system . Colloquial use of the term "relational database" may refer to the RDBMS software, or the relational database itself...
. The tool also comes with a large number of predefined code quality rules. Rules can be checked automatically during continuous integration
Continuous integration
In software engineering, continuous integration implements continuous processes of applying quality control — small pieces of effort, applied frequently...
.
Features
The main features of NDepend are:- Dependency Visualization (using dependency graphs, and dependency matrix)
- Software metrics (NDepend currently supports 82 code metrics: Cyclomatic complexityCyclomatic complexityCyclomatic complexity is a software metric . It was developed by Thomas J. McCabe, Sr. in 1976 and is used to indicate the complexity of a program. It directly measures the number of linearly independent paths through a program's source code...
; Afferent and Efferent CouplingCoupling (computer science)In computer science, coupling or dependency is the degree to which each program module relies on each one of the other modules.Coupling is usually contrasted with cohesion. Low coupling often correlates with high cohesion, and vice versa...
; Relational CohesionCohesion (computer science)In computer programming, cohesion is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is...
; Google page rank of .NET types; Percentage of code covered by tests, etc.) - Declarative code query using CQL
- Integration with CruiseControlCruiseControlIn software development, CruiseControl is a Java-based framework for a continuous build process. It includes, but is not limited to, plugins for email notification, Ant, and various source control tools. A web interface is provided to view the details of the current and previous builds...
and TeamCityTeamCityTeamCity is a Java-based build management and continuous integration server from JetBrains, creators of IntelliJ IDEA and ReSharper.It was first released on October 2, 2006.-Notable Features:... - Optional code constraints in the source code using .NET attributes.NET metadata.NET metadata, in the Microsoft .NET framework, refers to certain data structures embedded within the Common Intermediate Language code that describes the high-level structure of the code. Metadata describes all classes and class members that are defined in the assembly, and the classes and class...
- Version comparison of two versions of the same assembly.NET assemblyIn the .NET framework, an assembly is a compiled code library used for deployment, versioning, and security. There are two types: process assemblies and library assemblies . A process assembly represents a process that will use classes defined in library assemblies...
CQL
CQL (Code Query Language), is one of the innovations of NDepend. It is an SQLSQL
SQL is a programming language designed for managing data in relational database management systems ....
inspired query language: .NET assemblies can be queried in a very similar way that relational database are queried. For example:
- Which public methods have more than 30 lines of code?
SELECT METHODS WHERE NbLinesOfCode > 30 AND IsPublic
- Which classes implement System.IDisposable?
SELECT TYPES WHERE IsClass AND Implements "System.IDisposable"
- Which methods have been modified since the last release?
SELECT METHODS WHERE CodeWasChanged
See also
- Design Structure MatrixDesign Structure MatrixThe design structure matrix is a compact, matrix representation of a system or project...
- List of tools for static code analysis
- Software visualizationSoftware visualizationSoftware visualization is the static or animated 2-D or 3-D visual representation of information about software systems based on their structure, size, history, or behavior....
- CppDepend the NDepend like for C\C++
External links
NDepend reviewed by the .NET community
- Exiting The Zone Of Pain: Static Analysis with NDepend.aspx (Program Manager, Microsoft) discusses NDepend
- Stack Overflow discussion: use of NDepend
- Abhishek Sur, on NDepend
- NDepend code metrics by Andre Loker
- Static analysis with NDepend by Henry Cordes
- Hendry Luk discusses Continuous software quality with NDepend
- Jim Holmes (Author of the book "Windows Developer Power Tools"), on NDepend.
- Mário Romano discusses Metrics and Dependency Matrix with NDepend
- Nates Stuff review
- Scott Mitchell (MSDN Magazine), Code Exploration using NDepend
- Travis Illig on NDepend
Books that mention NDepend
- Marcin Kawalerowicz and Craig Berntson. Continuous Integration in .NET (2010)
- James Avery and Jim Holmes. Windows developer power tools (2006)
- Patrick Cauldwell and Scott Hanselman. Code Leader: Using People, Tools, and Processes to Build Successful Software (2008)
- Yogesh Shetty and Samir Jayaswal. Practical .NET for financial markets (2006)
- Paul Duvall. Continuous Integration (2007)
- Rick Leinecker and Vanessa L. Williams. Visual Studio 2008 All-In-One Desk Reference For Dummies (2008)
- Patrick Smacchia. Practical .Net 2 and C# 2: Harness the Platform, the Language, the Framework (2006)