Continued from Visual Studio ALM … stepping through Brian’s HOLs (Part 2) – Code Discovery, giving us the following bread crumbs to date:
Define Business Requirements > Project Planning > Code Discovery > … today’s menu includes class coupling.
||Suggested steps for the quick reference poster
|Exploring Class Coupling
- If we create a dependency graph by class, we get a view that looks interesting, can be daunting requires some further focus to be of value.
- We can experiment with all of the various layout, but the Quick Clusters layout view is the best, in this case, as it gives us a visual idea of the wealth of classes and the dependencies.
- Zoom into a class of interest, in the case of the HOL, we use Products … CTRL+Mouse Scroll Wheel allows you to beam yourself into the world of classes.
The thicker the grey line, the more relationships we need to worry about.
- Selecting the butterfly mode (A below) gives us another view of the relationships.
- Using the Neighborhood Browse Mode (B) we can further decrease the depth to branch out.
- But, we can do better …
- Select, for example the line between Product and OrderLine, then select the (+) to see and update the dependency graph properties. We reduce the noise further by only selecting types and methods as an example.
- The resultant graph now shows the OrderLine and Product classes, as well as their methods and types.
- To get to the dependency we can now select the Dependency matrix view, which gives us a neat matrix that shows the relationship going from OrderLine to the Product class.
- Key is to experiment with the various models, views and filters, creating a view that you feel comfortable with and which gives you the information you want and need. We saw in this quick step-through that we start with a lot of information and noise, but using the features we can focus in on the detail.
This has been a difficult “feature” gremlin to discover in the past. using the Visual Studio 2010 Ultimate we can, however, quickly visualize the circular reference gremlin.
- We start with the following view, which we created as part of the previous walk-through.
- Select the class of interest, in this case Product
- Right-click on diagram surface
- Select Circular Reference Analysis
- Red lines appear … highlighting circular references.
- Select the line between the two class and click the (+) symbol to see and update the dependency graph properties. We again reduce the noise further by only selecting types and methods as an example to get a focused diagram showing the circular reference:
- To get final confirmation we create a dependency matrix.
- This feature is really, really cool … it makes us productive, cutting down tedious, painstaking and error prone exploration and analysis of an existing system. The visual diagrams are a huge bonus, allowing us to zoom out, detect patterns and zoom in for detail.
- The only thing you need is time to explore the features, lots of practise to develop your style and digital processing power as some of the diagrams can take time and resources to evolve out of the code base.
In part 4, we will look at branch visualization …
| Acronyms | HOL - Hands-On-Lab | RI – Reverse Integration (merge) | TFS – Team Foundation Server |