IntelliJ IDEA 2018.3 Help

DSM analysis

Working on complicated projects with numerous dependencies makes it difficult to understand where to look for problems. You might encounter complex relationships, or cyclic dependencies, that may seriously affect application performance and behavior. This is where DSM helps.

DSM stands for Dependency Structure Matrix - a method that helps you visualize dependencies between the parts of a project (modules, classes, and so on.) and highlights the information flow within your project.

DSM analysis can be used to see how changes will affect the project. For example, if one of the classes needs to be changed, you can identify all dependencies and see how this change will propagate through the project.

Analyze dependency matrix

  1. From the main menu, select Analyze | Analyze Dependency Matrix.

  2. In the dialog that opens, select the scope that you want to analyze, and click OK.

If your project class files are out of date, the analysis may result in incomplete or incorrect data. To avoid this, IntelliJ IDEA prompts you to compile a project before continuing the DSM analysis.

The DSM tool window will open enabling you to examine dependencies. By clicking the cells in the tool window you can go in more detail.

DSM tool window

DSM tool window sorts dependencies in a special way: classes, which are used most are moved to the bottom.

On the matrix, all dependencies always flow from green to yellow: when you select a row, green annotations show dependent components, while the yellow ones show components on which the selected components depends. Mutual dependencies are shown in red. Various shades correspond to the number of dependencies. The more dependencies there are the darker the corresponding cell is.

Explore dependencies

You can limit the view to see only selected dependencies. In contrary to the Limit Scope option, only classes which produce selected dependencies are left.

  • In the DSM tool window, right-click the necessary dependency and select Explore Dependencies Between.

    The classes that produce these dependencies will be opened in a new tab in the DSM tool window.

Find usages for dependencies

You can open selected dependencies for further source-code analysis.

  • In the DSM tool window, right-click the necessary dependency and select Find Usages for Dependencies.

Limit the DSM scope

You can limit the scope of your DSM to the selected rows. Only these will remain in the new matrix.

  • Select the rows you want to keep, and from the context menu, select Limit Scope To Selection.

    The limited scope will be opened on a new tab in the DSM tool window.

Last modified: 7 December 2018

See Also