Graphical Analysis in Visual Studio

Today, we will review Graphical Analysis in Visual Studio and see how Visual Studio can help us in the analysis of existing source code through generations of graphics.

Creating a Class Diagram

Starting with the 2005 release, Visual Studio can generate a Class Diagram of the assembly of your choice.

This option is accessible through the menu of your development project.

 

This option generates a “ClassDiagram” file. cd “which contains the following diagram.

It is thus possible to visualize, order and explore its source code in a visual way to better understand its hierarchical organization.

Personalization

It is possible, depending on your needs, to filter what is displayed on the chart via the “Class Details” menu.

You will notice the last column consisting of checkboxes. If you do not want to see the events, just specify it in this window.

This display can also be useful to have a parallel of the diagram more “tabular”. We would have liked an opportunity to export this grid for statistical purposes. It’s not quite that, but if you open this file in text mode it’s just an XML file. This is what is generated for the “Document” entity.

<Class Name="SoftFluent.Samples.GED.Document" BaseTypeListCollapsed="true"> 
   <Position X="9.25" Y="0.5" Width="2.25" /> 
   <Members> 
     <Event Name="EntityAction" Hidden="true" /> 
     <Event Name="KeyChanged" Hidden="true" /> 
     <Event Name="PropertyChanged" Hidden="true" /> 
   </Members> 
   <Compartments> 
     <Compartment Name="Events" Collapsed="true" /> 
     <Compartment Name="Methods" Collapsed="true" /> 
   </Compartments> 
   <TypeIdentifier /> 
   <Lollipop Position="0.2" Collapsed="true" /> 
 </Class>

Export

You will probably need this diagram for:

  • support a technical presentation
  • illustrate a documentation
  • facilitate maintenance

If this happens, you do not need to install Visual Studio on your workstation. It is indeed possible to export your diagram as an image.

Conclusion

I hope this article will have made you want to analyze your source code in another way. Certainly, Graphical Analysis in Visual Studio is a powerful tool that can become handy one day to anyone.

You may also like...

Leave a Reply

Your email address will not be published.