We’ve had dependency analysis in Understand for many years. With B471 of Understand 2.0 we have consolidated it into a functional area of the tool, improved what it does and also added a few new dependency views.
The Dependency Analysis capability provides these features:
- rapid browsing of dependencies for files and Understand architectures
- Dependents, Depends On, and Butterfly graphs for files and architectures
- Spreadsheet export of dependency relationships
- A new Dependency Browsing dock that shows all depedency information
Read on to learn more about the Dependency Analysis capability and what we plan for it.
Or watch the video here.
Lots of Data
To calculate dependency we have to examine every refererence in an Understand project. We then build up dependency data structures for every file and architecture. This includes the nature of the dependency and the references that caused the depedency.
Because this can be a lot of data, we don’t calculate this as you ask for a given dependency relationship. Instead, we calculate all dependency information, cache it, and this makes subsquent exploration and browsing quick.
So the first step is to tell Understand you want to explore dependency information, by choosing:
Note the Scitools Labs icon next to the menu. This means this is an early feature, so don’t depend on it and also send feedback if you have ideas about it.
Depending on the size of the project building this cache can take a while. On 2 million lines of code, it will take about 15 seconds, but the time will depend on the reference density of the code.
After reparsing the cache will still be used, you currently have to remember to update it, although in a build or two we will ask if you want to update it.
Once the cache is created, you can now explore dependencies using the Dependency Browser. To get it, right click on a file or an architecture and choose “View Dependencies”
The Dependency Browser then pops up, by default docked to the right side of the interface.
The browser shows that “adler32.c” depends on two other files (zconf.h and zlib.h). Clicking on zconf.h shows the references that caused the dependence. It also shows that adler.c is depended on by 3 files, to see them click on the tab. Note that these references are hot, click on them to visit the source location.
The [x] Sync button at the top tells Understand to show dependency information for whatever entity you click on elsewhere in the interface.
We provide, currently, three graphs for files and architectures:
- Dependency Graph – edges show that node a depends on node b
- Reverse Dependency Graph – edges show that node a is depended on by node b
- ButterFly – shows dependence and dependency
To get a graph, just right click on the file or node in question, or choose the graph icon in the Dependency Browser:
Choosing the Dependency Graph for adler.c we get:
Adler.c depends on zlib.h twice in the code, and 4 times on zconf.h, and so on.
You can export relationship information for a file or architecture to CSV format by clicking on the icon. This will do output dependency relationships in matrix form for that entity.
You can also get the matrix for all files or architectures by choosing the CSV export options from the main Dependency menu:
We want your feedback on these features – both in how we implement them and also what else we should do.
Our plans currently include:
- Dependency information for Java, C#, C++ Classes & Ada Packages
- Dependency Rules – a specification system indicating permited and non-permitted dependencies
- Dependency Corrections – system for correcting false positives dependencies
- Access to Dependency Information from the C++ and PERL APIs