Modeling Websites and Native Code


I’ve blogged previously about the Architecture tools in Visual Studio 2010. These tools offer a fantastic way to understand an existing application, design some new functionality, and validate an implementation against architectural rules and constraints.

Recently, we announced the availability of the Visualization and Modeling Feature Pack for MSDN subscribers, which complements the Architecture tools in Visual Studio 2010 by adding support for:

  • C/C++ code visualization
  • Website visualization
  • Improved UML diagram generation
  • Code generation from UML diagrams
  • XMI 2.1 import
  • Architectural validation extensibility

Developers often face the challenge of trying to understand how changing one part of application will impact another. This kind of information is vital in controlling the inherent risk associated with modifying code.

C/C++ and web development pose the same set of risks with some additional complexities unique to them.  C/C++ development requires understanding the dependencies between #include files. Web development adds an extra layer of complexity by introducing content elements like pages and controls.

Today I’m going to go into more depth on the native code and website visualization features in the feature pack.

C/C++ Code Visualization 

If you have the sources to your C/C++ application, you can use the Generate Dependency Graph menu to visualize the static dependencies that exist between the various binaries.  Below I have the initial DGML diagram created for a photo viewer application:

I can then drill down by expanding these nodes to identify specific calls that create those dependencies.  I can then expand the nodes to find a dependency between the CWebImageManager class constructor in the PhotoBrowser application and the WinHttpOpen function in WinHttp.dll.

Another great way to visualize the static dependencies between various binaries is by simply dragging and dropping them from, say, the Windows Explorer window to an empty DGML diagram.

The feature pack also supports visualizing dependencies that exist between #include files.  You can visualize the dependencies between all the source and header files in your solution by selecting ‘By Include File’ from the Generate Dependency Graph menu, or you can choose to visualize dependencies for a specific file by invoking the “Generate Graph of Include Files” function from the source editor.

Below, you can see the direct dependencies for the PhotoViewerView.cpp file.  You can use Neighborhood Browse mode to drill down and discover all dependencies.

You can also explore your C/C++ projects via the Architecture Explorer, similar to how you would for managed projects or take advantage of project level dependency validation via layer diagrams.

Website Visualization

If you are using Visual Studio Web Application Projects, Web Sites, or ASP.NET MVC projects, this feature pack introduces rich structural and dependency visualization for your application and can drastically improve your ability to answer the question “What parts of my application are affected when I modify this code?”

To visualize your website structure and dependencies, use the Generate Dependency Graph menu:

This generates a DGML document below:

The resulting graph contains nodes for the various structural elements of your ASP.NET web application, namely

  • ASP.NET web pages (.aspx files)
  • Custom controls (.ascx files)
  • Master pages (.master files)
  • Website folders
  • Application files
  • Code behind types
  • Server controls

If you double-click on any one of these nodes, you are taken directly to source code.  This can be a great way to catalog and explore your website.

ASP.NET MVC support

When you generate a dependency graph for an ASP.NET MVC web application, you also get the MVC specific data below:

  • Controller to View links (using default conventions)
  • View to Model links
  • Node groups representing Areas and View folders

The Rest of your Application

Once you’ve explored the structure and dependencies of your website, you can also visualize the dependencies on the rest of your application by using the Get Code Dependencies feature.

Here the resulting graph is filtered to show a dependency chain all the way from the Checkout.aspx web page through the Order business logic class and the Payment Data access class.

Try It

If you are an MSDN subscriber, download the Visual Studio 2010 Visualization and Modeling Feature Pack and try it out.

Namaste!

Comments (15)

  1. If you're an MSDN _Ultimate_ subscriber, maybe says:

    Somasegar, when you say "MSDN subscriber", you should probably mention which subscription level is required. Some of us don't have MSDN Ultimate.

  2. Ashira says:

    Wow, this is awesome.

    Is this going to appear of MSDNAA?

  3. GregM says:

    I was just going to post the same thing about ultimate.  I spent 15 minutes trying to figure out if this was available in my subscription level (Premium) and the only way I could find out was to go and try to download it.  Since it's not available for me to download, I assume that means it requires Ultimate.

    It seems a lot of MS people don't know which version is required by the components they're talking about (probably since they all use Ultimate), or either just don't care to mention, since that would turn people off faster.  For example, almost none of the people talking about IntelliTrace (fka Historical Debubbing) mention that it is only available in VS Utimate.

  4. DrPizza says:

    I don't understand why MS even bothers developing this stuff, given that approximately no developers actually have Ultimate subscriptions.

    If this stuff is so great, why not price it at a level that even small ISVs can justify?

  5. Jamistan says:

    Ha! If U dont have MSDN Ultimate then why are Torrent made for…

  6. Srinivasan S Saripalli says:

    This post is great but would also be good if you can release "Visualization and Modeling Feature Pack" for Visual Studio 2008 and Visual Studio 2005.

    I said Visual Studio 2005 because maybe I felt this feature pack might be useful for projects generated by using Windows CE 6.0 R3 Platform Builder

  7. Ramesh says:

    See Brian Harry's post – "What on Earth is a Feature Pack" (blogs.msdn.com/…/what-on-earth-is-a-feature-pack.aspx) to see the rationale behind why an MSDN subscription is required to download the feature pack.

  8. Sarath says:

    @DrPizza – I completely agree with your view point. I'm not sure about it, as my company provides latest version of Visual Studio. Seems MSDN subscription is entirely different from Visual Studio Licensing. Better to sell it separately or with professional edition or Team system!

  9. Sean says:

    Hi,

    There have been a few questions on how to get the feature pack.  The Visualization and Modeling Feature pack requires an active VS Ultimate + MSDN subscription.  This can be acquired as:

    • VS Ultimate + MSDN (directly in retail or volume licensing)

    • Through a BizSpark membership, or (for start-ups)

    • Through an MSDN AA [Developer AA] subscription (for academic institutions)

    Sean (MSFT)

  10. Alistair Leslie-Hughes says:

    MDG Integration for Visual Studio from Sparx Systems allows you to create XML model diagram from your own code.

    Their latest beta version supports VS 2010.  

    http://www.sparxsystems.com/…/YaBB.cgi

    A cheaper option then a MSDN subscription.

  11. SinaJazayeri says:

    I've installed the Visualization and Modeling Feature Feature Pack – one of the feature improvements is supposed to be providing bi-directional links between TFS Work Items and Model Elements – for this to work a new Model Link Type is said to be required to be installed at the machine with TFS installation – instructions (msdn.microsoft.com/…/ff657802.aspx) for this ask the user to copy a .dll file (Microsoft.VisualStudio.ArchitectureTools.WorkItemLinking.ServerRegistration.dll)

    from the PC which has the Feature Pack installation from a specific folder (C:UsersUserNameAppDataLocalMicrosoftVisualStudio10.0ExtensionsMicrosoft<InsertVisualStudioFeaturePackName>1.0) for installation on the TFS machine – the problem is that there in so such folder on my machine – any idea where to get this dll?

  12. SuhailDutta says:

    Hey SinaJazayeri,

    If you've installed the feature pack on your machine, you should have the folder and the file the instructions mention.

    Can you verify

    1. You have the feature pack installed and are looking on the machine it is installed on.

    2. You've changed 'UserName' to the username you have logged in with.

    3. You've changed '<InsertVisualStudioFeaturePackName>' to 'Visualization and Modeling Feature Pack'

    C:UsersUserNameAppDataLocalMicrosoftVisualStudio10.0ExtensionsMicrosoft<InsertVisualStudioFeaturePackName>1.0

    Thanks

    Suhail (MSFT)

  13. BT says:

    Is it possible to have a code sequence diagram that includes calls to native components?

    What are the specific settings to enable this?

    Thanks!

  14. Ramesh says:

    Hi BT,

    Unfortunately generating sequence diagrams from native code is not supported in the feature pack.  However, it is something we are considering in one of our future releases.

    BTW, the Modeling and Tools forum on MSDN (social.msdn.microsoft.com/…/threads) is a great place to provide feedback and comments on architecture, modeling and code visualization topics.

    Thanks,

    Ramesh (MSFT).

  15. Hareesh says:

    Looks something like this: http://www.newfaces.com

    Everyone knows this! It's been live for 15 years.

Skip to main content