 |
Tutorial :
|
-
How do I analyze my .NET applications using NDepend?
-
What does the NDepend report tell me about my code?
-
I want to go further to have a better control over my code
How do I analyze my .NET applications using NDepend?
- Run VisualNDepend.exe
- Select the option: Analyze a set of .NET assemblies
- Populate the data grid with your assemblies by using the browse button or by using drag and drop from Windows Explorer.
- Click OK.
It will trigger the analysis of your assemblies and code source by NDepend.Console.exe.
This analysis will take a few seconds to a few minutes depending on the size of the assemblies.
- Once the analysis done, the result is displayed in the VisualNDepend.exe UI.
In order to make the most of the VisualNDepend UI, see online demos referenced above.
What does the NDepend report tell me about my code?
-
Application Metric:
This section gives you an idea of the topology of your application.
-
Assembly Metric:
This section gives you an idea of the size of each assembly within your
application in terms of #IL instructions and others metrics.
-
VisualNDepend View:
This section illustrates the size of your assemblies, namespaces, types
and methods in terms of #IL instructions. You can browse this view
dynamically by clicking the Launch Visual NDepend on this Project icon
in the NDepend.Project UI.
-
Assembly Abstracness vs. Instability:
This section illustrate the Abstracness/Instability principle explained in the assemblies metrics section.
-
Assembly Dependencies:
This section shows all dependencies between assemblies of your
application in a table.
-
Assembly Dependency Diagram:
This section shows all dependencies between assemblies of your
application in a diagram
-
Assembly build order:
This section gives you one of the possible build order for your assemblies.
If a cycle exists in your assemblies dependencies graph, this section
will report it.
-
NDepend information and warnings:
This sections gives you advices about your code:
-
It warns you when an assembly depends on a less stable assembly than itself.
-
It warns you when the visibility of a type or of a member is not optimal
(in the context of the analysed application).
-
It warns you when a type or a member is not used
(in the context of the analysed application).
-
CQL Queries and Constraints:
This section reports default CQL constraints which have been violated.
More about the CQL language and CQL constraints here.
You can build your own CQL constraints with VisualNDepend. Click the
Launch Visual NDepend on this Project icon in the NDepend.Project UI.
-
Type Metrics:
This section recaps type metrics in a table. A link to the documentation
is provided for each metric.
I want to go further to have a better control over my code
-
See online demos quoted on http://NDepend.com home page.
-
Understand metrics yielded by NDepend and read recommendations.
-
Get a new understanding of your code by playing with the VisualNDepend
views. Modify the view with the Level and Metric combo boxes.
-
Tune your report thanks to the Output panel in the NDepend.Project UI.
-
Learn CQL (Code Query Language) and create custom CQL constraints with
VisualNDepend.
You'll find it useful mainly to create:
-
Naming constraints (for example: I want the static fields of these assemblies ...
to be named like that).
-
Code quality constraints (for example: I don't want methods with more
than 200 IL instructions, except for generated methods which are ...).
-
Encapsulation constraints (for example: I don't want that the constructors of
these classes ... are called outside this namespace).
-
Integrate the NDepend report in your daily build process. Facilities are provided
for both MSBuild and NAnt build technologies. Read the ReadMe.txt files
contained in the .\MSBuild\ and .\NAnt\ folders.
-
Use the FxCop tool:
FxCop is a Microsoft freeware code analysis tool that checks .NET managed
code assemblies for conformance to the Microsoft .NET Framework Design Guidelines.
-
Use the promising NStatic tool (not released yet):
-
Read the book Practical .NET2 and C#2 to have a better knowledge of .NET2 and C#2.
List of .NET2.0 new features covered by the book is available here.
Sample chapters are available here.
-
Read the book Framework Design Guidelines to write better code.
|
|
Last Product Update:
September 25, 2008
NDepend 2.10.2
NDepend Partners
Featured customers:
NDepend is built on top of:
Cecil
QuickGraph
GraphViz
DXperience
NDepend integrates with:
VisualStudio
Reflector
MSBuild
NAnt
CruiseControl.NET
|
|