Dependency Finder logo Code analysis, API diffs, OO metrics ...

Dependency Finder

Dependency Finder is a suite of tools for analyzing compiled Java code. At the core is a powerful dependency analysis application that extracts dependency graphs and mines them for useful information. This application comes in many forms for your ease of use, including command-line tools, a Swing-based application, a web application ready to be deployed in an application server, and a set of Ant tasks.

JarJarDiff is another important tool in the suite. It compares two versions of the same codebase and reports the differences in the API. It lists new, changed, and removed elements such as packages, classes, methods, and more. You can tailor the reports to focus on your public, published API versus the private, internal one.

Finally, Dependency Finder has a tool for computing object-oriented software metrics that give you an empirical quality assessment of your code. Once again, you can tailor the report to focus on the metrics that you care about and adjust validity thresholds to the specifics of your project.

Why use Dependency Finder instead of the alternatives?

Dependency Finder is not the only game in town. Tools like IntelliJ and Xrefactory have great features that let you track down usage of selected classes or methods. So why should you bother with yet another tool?

By the way, I keep an informal list of the competition on the resources page.

For starters, Dependency Finder is free. Free as in "free beer" since it costs no money; and free as in "free speech" since you can get the sources and do whatever you want with them (except take my name off, that is).

Dependency Finder has a powerful querying mechanism based on Perl regular expressions. Whereas other tools can show you usage for a single method, Dependency Finder can show you usage for many methods, and possibly all of them, at a single glance. For example, "Show me all calls to constructors of this class." With other tools, you have to select each constructor in turn, have the tool generate usage information for it, save the results, and aggregate them later somehow, if at all. I don't know about you, but I have more important things to do, like fix bugs and write new feature.

The web application lets you share a dependency graph with your entire team. Anyone can query the graph with nothing more than a browser. They don't have to install anything or wait after the tools to extract a graph from code. The graph is there, all the time, at everyone's disposal. You can even have your nightly build regenerate the graph after each successful compilation run.

Dependency Finder can compute closures, that is, follow dependencies and find everything reachable from a given start point. This can help you package related components together, or verify that your code respects encapsulation.

And Dependency Finder includes many more tools. See the user manual and the tool list for all it has to offer.

Why bother with dependencies at all?

Many authors have stressed the importance of managing depencencies (Robert C. Martin, John Lakos, Martin Fowler). Managing dependencies means securing encapsulation and making sure that the code follows the architecture. It is also essential for the modularization of code and favors reuse. By extracting the information from the code itself, we can detect where we were sloppy, where we took shortcuts that we shouldn't have. Managing the dependencies can even shorten the compilation time of the code.

At first, I thought of using the Reflection API, but it showed only the class's attributes and method signatures. If a method used some other class for a local variable or called a static method, that dependency that would not show under the Reflection API. So I had to build a suite of tools that could extract dependencies from compiled Java code directly. The tools can get all the necessary information out of the .class files.

Praise for Dependency Finder

Dependency Finder is a critical component in our manufacturing process. We have been building our product since 1996, we initially wrote a homegrown Dependency Analysis program for a few small applet jar files. But as our product grew our Dependencies increased, and so did the time needed to analyze the results. We hadn?t created a database in our homegrown system. Dependency finder reduced the time our system took from 2 hours to 5 or 6 minutes. Today we use Dependency Finder to determine the contents of 21 jar files.

Another major advantage of using Dependency Finder is to be compatible with the Microsoft 1.1 JVM issues. We needed to compile select class files with the javac -target 1.1 option, so the Applets would run in the OLD JVM. We first compile with the newest compilers, then analyze the results and recompile only the necessary classes with the older compiler target.

Thanks a lot for producing this great program.
        -- Peter Lenahan
           Technical Director
           Information Builders, Inc.
Dependency Finder is an integral part of the everyday development work as well as of the nightly build at our company.

We are using its Ant tasks in our nightly build to generate the dependency graph of our entire suite of 23 subprojects (7000 classes). This graph is then loaded into our Tomcat servlet engine and stays in memory during the work day for interactive queries from development machines which execute in a matter of seconds.

We are also utilizing the implementation of the standard object- oriented metrics of Dependency Finder extracted from the dependency graph to get an overall idea of where software rot has begun. What would be even better is getting adequate visual representation of the current stand of our Java source and pinpointing offending packages or classes according to easily configurable criteria.

All in all, Dependency Finder is a reliable, high-quality tool which is versatile enough to be used in batch as well as in interactive mode. It is well suited to be used for project comprehension and management.
	-- Svetlin Stanchev
	   360 Treasury Systems
After source control and Ant, Dependency Finder is the most used software in our build process. It makes pinpointing dependencies fast because of search with regular expressions. Through its Ant extensions, the Finder is linked to our nightly build and automates tasks like comparing APIs and enforcing system dependency rules. We use Metrics to help determine if work on a subsystem will require a new branch. It has delivered more productivity than any other build system we use.
	-- Tom Quigley
	   Release Engineer
	   Vignette Corp.
It would have taken us at least twice the time to automate several parts of our public API management process if it were not for the Dependency Finder toolkit.
	-- Miles Chaston
	   Vignette Application Portal Chief Architect
	   Vignette Corp.
Thanks for this excellent program ! I have cited its use in one of my research papers thus far, and plan on doing so in many more.
	-- Steve Kirk
	   University of Trollhättan/Uddevalla
Congratulation for Dependency Finder, a brilliant piece of software.
	-- Christophe Thiébaud
Thanks for DependencyFinder; I'm finding it useful for determining what might break in other people's code prior to some refactorings.
	-- Jonathan Doughty
	   The MITRE Corporation