Share via


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

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

  • Anonymous
    June 18, 2010
    Wow, this is awesome. Is this going to appear of MSDNAA?

  • Anonymous
    June 18, 2010
    The comment has been removed

  • Anonymous
    June 18, 2010
    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?

  • Anonymous
    June 18, 2010
    Ha! If U dont have MSDN Ultimate then why are Torrent made for...

  • Anonymous
    June 18, 2010
    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

  • Anonymous
    June 20, 2010
    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.

  • Anonymous
    June 20, 2010
    @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!

  • Anonymous
    June 21, 2010
    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)

  • Anonymous
    June 30, 2010
    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.   www.sparxsystems.com/.../YaBB.cgi A cheaper option then a MSDN subscription.

  • Anonymous
    October 11, 2010
    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?

  • Anonymous
    October 11, 2010
    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)
  • Anonymous
    November 08, 2010
    The comment has been removed

  • Anonymous
    November 08, 2010
    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).

  • Anonymous
    April 14, 2011
    Looks something like this: www.newfaces.com Everyone knows this! It's been live for 15 years.