Can someone show me what a good dependency matrix looks like and specify why?
Erik Dörnenburg gives the best description I've seen, including some good examples of how arrangements of the graph can expose structural issues. Briefly:
- as others have mentioned, anything above the diagonal indicates a cycle, which essentially means that your boundaries are "fuzzy" (not clean)
- smallish squares (well, lower triangles) along the diagonal == good, if the components are grouped according to hierarchy
- on the other hand, heavily weighted rows or columns == possible issues: either
- rows: you have a component/group that lots of others depend on (maybe it's trying to serve too many features), or
- columns: you have a component/group that depends on lots of others (maybe it's trying to take care of everything itself, instead of delegating)
On this blog post Identify Code Structure Patterns with No Effort it is explained how to use a Dependency Structure Matrix to identify Code Structure Patterns. The screenshots are done with the Dependency Structure Matrix of the tool NDepend. Here are a few patterns:
Layered code (code with no cycle, certainly the coolest thing that a DSM can show you at a glance)
Code with dependency cycles
High Cohesion / Low-Coupling
Hungry Caller
Popular Callee
Mutual Coupling
Data Object