As a Software Designer/Architect maybe you have already noted that there is a lack of useful tools (and formal concepts/methodologies!). One of the few tools offered by Microsoft is the Dependency Graph Generator. This tool is pretty simple: it shows how assemblies, namespaces, classes and/or methods are dependent each other. The tool can be accessed within Visual Studio by clicking in the menu Architecture > Generate Dependency Graph and then choosing the appropriate level (the top level –by assembly- always works for me).

After generating the diagram for a typical 3 tier/3 layer application you will have to manually delete all the distractions (including unwanted and external assemblies) to get a simple diagram like the following one. Note that gray lines of varying thicknesses represent the magnitude of relationship interdependencies between assemblies, with thicker lines equating to more relationships.

The tool’s power does not rely on itself but instead in all what you can do with the diagrams. Some of the tasks you can do with these diagrams are described as follows:

  1. Layer’s granularity: to ensure the project does not have few or many layers.
  2. Layer’s communication: to enforce the communication policy (in the previous sample the communication was strict iteration, which it means upper layers can communicate only with the next lower one).
  3. Cross-cutting concerns: you can see if a cross-cutting package is being used ok (i.e. exceptions).
  4. Facades: you can check if a Façade exists in some layers and if it’s being used for at least the 80% of the possible consumers. This includes (but it is not restricted)  inputs must be simple data values or common shared abstractions.
  5. Packages: you can check if the project is being grouped in a “manageable level”, which means that each layer should have up to 7 packages representing different business domains; likewise each package should have up to 7 classes.

Important notes:

a)      For those using Visual Studio 2012: graphs have more filtering options and can be moved around.

b)      If you’re looking for automated layer validation this is the right tool.

Cheers,

Javier Andrés Cáceres Alvis

Microsoft Most Valuable Professional – MVP
Intel Black Belt Software Developer