Understand Code Dependencies with Visual Studio

access_time 6 years ago visibility836 comment 0

Visual Studio provides a convenient tool to generate visual code dependencies. It helps to identity circular references issues and also hubs.

To learn more details about this function, visit http://msdn.microsoft.com/library/dd409453(VS.110).aspx.

Find the tool

Go to menu “Architecture –> Generate Dependency Graph” and you will be able to generate the visual diagrams for your projects or solution.

image

Sample – Hub

image

ContextProject.DataServices.The above diagram shows how my projects reference to each other.  Three projects are Hubs: ContextProject.Website, ContextProject.DataServices.Syndication, ContextProject.DataServices.MetaWeblog and ContextProject.DataServices, which implies that they are the top 25% highly connected nodes.

image

Because of these dependencies, it is hard to change and maintain the code. We can refactor can components to reduce the complexity of dependencies.

Sample – Circular Reference

Expand the assembly nodes,  we can identify the circular references.

image

In the above diagram, three namespaces form a circular reference. Drilling-down to details, I find out the static property Configurations caused this issue.

image

Sample – Other

I am planning to replace my IoC component NInject with Microsoft Unity. The visual dependency diagram can help me to find out all the classes/properties/methods I need to change.

image

Summary

The visual dependencies can help us identify code that might be overly complex or that might need improvement. It will be very useful when you begin to analyze a new project you didn’t work on before.

info Last modified by Administrator at 26 days ago copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

Want to publish your article on Kontext?

Learn more

Kontext Column

Created for everyone to publish data, programming and cloud related articles.
Follow three steps to create your columns.


Learn more arrow_forward

More from Kontext

local_offer dotnetcore

visibility 796
thumb_up 0
access_time 6 years ago

First of all, I’d like to thank you Patrick (owner of NDepend http://www.ndepend.com ) to provide me the professional license of NDepend. This is definitely a cool and powerful tool even I just started using it. In this post, I am going to introduce the simple steps I used to detect my ...

local_offer linux

visibility 2119
thumb_up 0
access_time 3 years ago

This page summarizes the steps to mount a windows shared folder in a Linux VMware guest machine, i.e. SUSE. In Virtual Machine Settings windows, add shared folder. Run the following command line in your virtual machine: /usr/bin/vmware-hgfsclient This command will output the available ...

local_offer linux local_offer WSL local_offer ubuntu local_offer big-data-on-wsl

visibility 9521
thumb_up 4
access_time 2 years ago

This page shows how to install Windows Subsystem for Linux (WSL) system on a non-system drive manually. Open PowerShell as Administrator and run the following command to enable WSL feature: Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux Run the following ...