A design structure matrix (or dependency structure matrix) can help you to analyze the dependencies of your system and spot potential problems. This is especially useful when analyzing code, like you can do with the .NET Reflector Add-In you can find here.
Since certain aspects of your system structure can also be derived from the Sitecore content tree, I thought it might be useful to make a DSM for that. The aspx at the end of this post can be used to analyze the dependencies in your content tree!
An example of how this can be useful:
Let’s say you have a multisite Sitecore environment that currently has 3 websites (A, B and C). Some parts of the websites are quite similar and developers have copied different items between the websites. Website B is (functionally) essentially a subsite of site A. You could say that website B ‘depends’ on website A. And actually, since website A will have a link to site B, website A also depends on website B. Website C should be completely independent.
Now, I have opened the DSM aspx. After selecting the master database, expanding all the relevant nodes and selecting the websites, I am now ready to create a DSM. After clicking the “Update DSM data” button, I can see the following:
From this matrix, I can see the following (start reading by choosing a row and then choose the cell; the numbers in the top row reference the items in the column on the left):
– Website A (or one of its descendants) has 1 link to website B (or one of its descendants).
– Website B (or one of its descendants) has 3 link to website A (or one of its descendants).
– Website C (or one of its descendants) has 1 link to website B (or one of its descendants).
That last one could be a problem! Website C should have no links to the other websites. This probably happened because I copied something from website B to website C and I forgot to change the link.
To see where the problem is exactly, I click on the table cell (coordinate: 1.3 Website C, 1.2). The information in the next image is displayed:
The menu configuration for website C references a page in website B, instead of a page in website C. After I correct this error, I click “Update DSM data” again. Now the matrix looks like this:
That’s better; Only websites A and B now have references to each other.
If I need a more detailed look, I can select anything that I think is relevant in the tree. So the aspx page could look like this:
You have to get used to reading this type of matrix, but it can be a very useful tool. This example is obviously quite simple; more complex situations may be found in the “real world”.
The tool is not exclusively for solving problems. It can also be helpful for quickly understanding how a system is setup.
Just copy the following code to an aspx file and you’re ready to use the tool: