Architecture Exploration with VSTA2010

Did some playing today with the Architecture Explorer in 2010, which generates some nice interactive, navigable graphs from code or assembly.

I used the Architecture Explorer for different kind of application architectures, actually different kind of UI implementations. Just as I did a while ago with this post Rosario - Architecture Explorer's Dependency Matrix and this very old post Visual Studio 2008 Features: Code Metrics.

You can analyze relationships at assembly, class and namespace level. The first implementation doesn't show much magic [it’s just a drag and drop winform implementation, see previous posts] and as you probably see in the graph below, there is a form with two classes employees and and employee direct coupled to this form.

 0

The namespace graph, doesn't add much information to it. Only that the namespaces are visualized, it just looks like an layer diagram.

5

the default class diagram view  gets a little bit complex due to all the methods and properties in the code behind file. Also you can see the employee class with all his properties and the very thin Employees class with only two methods

3 

This is another view where I selected all the interesting classes and methods.
At the top-middle of the graph you can see very easy the interaction between employeeform, cmdLookup and the Employees lookup method.

4

But this isn’t a very interesting implementation so let’s look at a kind of Model-View-Controller implementation. If you have read the “Rosario - Architecture Explorer's Dependency Matrix ” post you already know that this one has a cyclic dependency.
The namespace view nicely shows this dependency and the three namespaces used in this solution

8

With a more detailed view we can find the methods responsible for this dependency. [click to enlarge]. Actually all the methods on the top have a dependency with the form and with the controller.

9

Next a more complex implementation, adapter pattern together with the command pattern and observer. In this kind of applications the architecture explorer gets valuable, during courses I give all these implementations to the attendees and give them the assignment to figure out how the implementation works and what are the pros and cons of the implementation. This one I often have to explain, just because they only have the code. with a diagram like this… it will be easy for them [this is the namespace view].

11

More detailed it looks like this, more loose coupled solution and the controller doesn't know the view.

12

and finally an MVP implementation with interfaces…

13

 

So, that's it…  is it useful? yes definitely especially with more complex solution. Architecture Validation is hard, but the Architecture Explorer isn't meant for validation it’s for discovery and that works, although the default views have a lot of noise from the code behind files, properties and settings files. But, with manual selection of classes we get some nice overviews.  I do think there are some preferred filter methods/ practices when you want to find something specific, at this time I select every possible option till I find something what fits me needs… have to work on that.

Add comment