InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

IntelliJ IDEA's Dependency Structure Matrix Tool Visualizes Architecture

Posted by Michael Bushe on Feb 12, 2008

Sections
Process & Practices,
Architecture & Design,
Development
Topics
Code Analysis ,
Artifacts & Tools ,
Architecture
Tags
Visualization ,
IntelliJ IDEA

A major characteristic of good architecture is layering components such that dependencies between modules flow down through the architecture.  Describing and maintaining dependencies between components is a common yet difficult task.  UML package diagrams offer a way to describe such dependencies, but they are often time consuming to create and, even when reverse-engineered, it takes a long time to acheive a grokkable layout.  UML also doesn't scale well - maintaining dependency diagrams in UML for large complex systems rarely provides as much payback as the effort invested.

A newer technology, Dependency Structure Matrices (DSM), has emerged to fill this gap.  DSM presents a matrix where each row is a module and the columns show the same set of modules in the other dimension.  Each cell shows an intersection of two modules and a count of the dependencies between them.  Without any more information, one can quickly intuit the beauty of DSM visualizations through this classic example.

 

DSM of a layered system


DSM of a Layered System



DSM of a strictly layered system.


DSM of a Strictly Layered System


Going beyond the quick glance, each row represents a package in a layered architecture.  The rows are numbered 1-5.  The columns are also numbered 1-5, and represent the same modules, respectively.  In the strictly layered system, the application depends only on the model (37 times), the model depends only on the domain, etc.  In the layered system, higher layers, such as application, can depend on any lower layer, such as util.  Given this visualization, if code is written that breaks the rules, it will be immediately obvious.  Any dependencies showing up in the upper right would break the architecture's intention.

IntelliJ has introduced a new DSM tool in the new "Magnificent 7" release.  Instead of having to think about the intended layering of a codebase and arrange a UML diagram manually, IntelliJ will automatically generate a DSM from an existing project.  Like other DSM tools, it automatically arranges nodes so that the dependencies tend to show up in the lower left.  A DSM is interactive and drillable to the class level:


DSM for the EventBus, drilled to the class level


IntelliJ DSM of the EventBus library


In this example, IntelliJ's DSM tool shows that ReferenceStrength is used 4 times in a layer below it in the architecture.  Having a DSM tool integrated into an IDE is very handy.  IDEA can easily show all 4 references in the codebase, making the problem easy to fix.   In this case, ReferenceStrength can be moved to a higher-level package using IntelliJ's refactoring tools.  

navigation to the broken dependency


IntelliJ DSM Navigates to a Broken Dependency 


IntelliJ's DSM tool has room for improvement.  Unusual for IDEA, it lacks the usability acheived by numbered rows and columns shown earlier.  Other tools, such as Lattix, have more powerful refactoring support.  Lattix can move classes or packages directly from the matrix visualization.  

Lattix Refactoring


Lattix Refactoring 


DSM is a powerful tools that is making its way onto the desktop of more practitioners.  

Another good tool by Pete Haidinyak Posted
Maybe IDEA 8.0 will be better? by Ted Young Posted
  1. Back to top

    Another good tool

    by Pete Haidinyak

    I use Structure101 which does a great job at visualizing dependencies between modules.

  2. Back to top

    Maybe IDEA 8.0 will be better?

    by Ted Young

    The addition of DSM to IDEA is really nice, but I agree that it'd be great to be able to refactor directly from the matrix. Of course, without better documentation, IDEA's DSM isn't going to get much use. Hopefully JetBrains will release new documentation soon.

    - Ted Young

Educational Content

Jesper Boeg on Priming Kanban

In this interview, Jesper Boeg, author of the new InfoQ book – Priming Kanban, discusses the keys to using Kanban effectively, and how to get started if you are currently using other approaches.

New-age Transactional Systems - Not Your Grandpa's OLTP

John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.