Showing posts with label Visual Studio 2010. Show all posts
Showing posts with label Visual Studio 2010. Show all posts

Wednesday, May 5, 2010

Application Architectural and more Layer Diagram

In my previous post, I talked about one of the new modeling capabilities in visual studio 2010, without giving any background on application architecture which would cover what layers are. If you are lacking knowledge or experience in this area I recommend the architectural guide published by Microsoft's patterns and practices group. You definitely can't beat the price. Download the book here: http://msdn.microsoft.com/en-us/library/ff650706.aspx

I downloaded the guide a while ago so when looking for the download link, I discovered another nugget from Microsoft for layer diagrams. From the same URL above you can download layer diagram templates that match what is covered in the book.

  1. After installing create a new layer diagram and your toolbox will contain the following:

  2. When I selected Rich Client Application it added the following to my diagram.


  3. Now you can create your projects and add them to the correct layer. Then add your dependencies. Which brings up another point I skipped in my last post, if your solution is already up and running and projects referencing each other the way you want modeling you can have Visual Studio auto detect dependencies by selecting "generate dependencies" from the context menu:

Saturday, May 1, 2010

Visual Studio 2010 - Layer diagrams

Disclaimer: The feature described in this post requires either the ultimate or the premium editions. For a good visual of the edition differences see the visual studio 2010 editions poster (http://vs2010quickref.codeplex.com/)

The layer diagram is a new feature in visual studio 2010 which allows an architect to visualize applications layers and the desired communication and dependencies between the layers and components. Big deal right – you can do that in power point if you had to. Ah but the goodness with the layer diagram is that it can enforce the dependencies between layers. Therefore it is possible to stop rouge leader from having the UIX layer from accessing the data layer directly.

Getting Started

  1. Select New Diagram from the Architecture menu in visual studio
  2. Select Layer Diagram and give it a name. I recommend also adding a new project that will hold your various diagrams.
  3. Now using the toolbox, you can add you application layers and the dependencies between them
  4. To enforce these dependencies you can associate your solution projects to the appropriate layer. Using the solution explorer drag each project to the appropriate layer. Each layer will show a count of projects associated with the layer.
  5. This view shows how many projects are associated to each layer, but to see the actual projects you need to open the layer explorer
  6. The layer explorer:
  7. You can now have visual studio validate that your solution matches your architecture by opening the context menu and selecting validate architecture. This will return errors if you solution validates your diagram.
  8. Tie the validation to your builds and TFS work items:
    • You can modify your modeling project to validate on every build
    • If using CI (Continuous Integration) with TFS or MS Build you can add an option to validate your model with every build.
    • You can add work items for each violation

Wrapping it up

I've shown a very basic layer diagram but MS has provided screenshots of the potential diagrams with a true enterprise application

For more information and details see: