Dependency Analysis for Java (DA4Java)

DA4Java is currently not available for download.

DA4Java is an Eclipse plugin developed on top of Evolizer to visualize and analyze Java source code. Source code is visualized with nested graphs. DA4Java comes with various features to incrementally add source code information, as well as, features to filter information from the graph. Users can combine top-down with bottom-up analysis and by this get insights into both, the overall structure of a system and the gory details.

The following figure shows a screen shot of applying DA4Java on its own source code.

da4java-screenshot.jpg

You can easily see that DA4Java consists of 5 top level packages. The red arcs represent method invocations between the packages while the blue arcs represent field accesses.

Installation

DA4Java is currently not available for download.

The minimum requirements for DA4Java are Java 1.6.0 and Eclipse 3.5. DA4Java runs best within an Eclipse 64 Bit installation. The most recent version has been tested with Java 1.6, Eclipse 3.7.2 and MySQL 5.5.11 (on MacOS). The tool is currently not running on Oracle's Java 1.7 on MacOS since the SWT_AWT bridge is not properly implemented by Oracle's Java 1.7.

Getting started

To run DA4Java make sure that the JVM running Eclipse is given enough memory: set -Xms512m -Xmx2024m -XX:PermSize=128m (these are the settings that work also for larger projects)

DA4Java visualizes source code data which conforms to the FAMIX model. Before using DA4Java you need to extract such a model from the selected Java project (or portions of it).

Extracting the FAMIX model

Using the in-memory database (H2)

For analyzing small to medium-sized Java projects we suggest to use the in-memory database. The following steps need to be executed to configure the in-memory database:
  • Enable Evolizer: Select the project, right click and select Evolizer -> Enable Evolizer from the context menu. Leave the default values and just click Finish to set the Evolizer nature for the Java project.
  • Enable in-memory database: Right-click on the Java project, select Properties. Select the Evolizer property page and activate "Use in-memory database". Click Apply and Ok to store the configuration.
  • The first time, DA4Java is invoked on the project, the FAMIX model is extracted and stored into the in-memory db. Note, that the data is lost when Eclipse is closed.

Using a MySQL database

When analyzing large projects, the use of a MySQL database is preferred. For this, first a FAMIX model from the Java source code needs to be extracted and stored to the MySQL database. Extracting the FAMIX model from Java source code is straight forward with the Evolizer FAMIX Importer:

  • Create a database on the MySQL server. (e.g., create database Test) and grant access to the database for your database account (e.g., grant all on test.* to 'user'@'localhost').
  • Start Eclipse and make sure the project you want to analyze compiles without errors (although the importer can handle errors they might lead to unwanted behaviour). Select the project, right click and select Evolizer -> Enable Evolizer from the context menu. Enter the MySQL hostname (e.g., localhost:3306), database name (e.g., Test), user (e.g., user), and your password. Click Finish and the project will get the Evolizer nature.
  • Select the project again, right click and from the context menu select Evolizer -> Famix -> Extract FAMIX. The FAMIX Importer starts parsing the Java source files of the project.
  • After the importer has finished the parsing (watch the progress monitor) right click again on the project and from the context menu select Evolizer -> Famix -> Store FAMIX. This action stores the source code information into the MySQL database. For large projects this can take a while.

First steps with DA4Java

After the FAMIX model has been stored to the database you can use DA4Java to visualize and analyze the project's source code. The core features of DA4Java are:

  • Visualize source code: In the Eclipse Package Explorer or Outline view select the project, packages, classes, methods, or fields that you would like to start your analysis from. Right click and from the context menu select Evolizer -> DA4Java -> Show in Graph. DA4Java supports multiple graph editors to analyze different projects or portions of source code in parallel.
  • Add entities: In the Eclipse Package Explorer or Outline view select the source code entities and from the context menu select Evolizer -> DA4Java -> Add to Graph. The selected entities are added to the currently active graph editor window.
  • Expand/collapse: Use the "+/-" in the top left corner of folder entities to expand/collapse package and class nodes. When a folder node is expanded the contained entities are shown. The dependencies to these entities are expanded as well. When a folder node is collapsed the entities are hidden and dependencies to contained entities are aggregated.
  • Add dependent entities: Select the node in the graph and from the context menu select Add -> All dependencies -> All to add all dependent entities of the selected node and their dependencies to the graph. You can reduce the amount of information to only adding entities that are referred by incoming or outgoing dependencies. Furthermore, you can restrict the dependencies by type, for example, add only entities that call methods of the selected node. Note that only the dependent entities and their parent entities are added to the graph. This greatly helps to limit the complexity of the graph.
  • Add descendant nodes and dependencies: Select the node in the graph and from the context menu select Add -> Descendants & Dependencies. Descendant entities and their dependencies to nodes currently contained by the graph are added.
  • Filter selected entities: Select the nodes and edges to filter from the graph. Child nodes and all dependencies of selected nodes are filtered from the graph as well. A similar feature of DA4Java can be used to filter edges between selected nodes that are of a particular type.
  • Filter dependent entities: DA4Java provides features to focus the analysis on the dependencies of the selected node. Filer -> Keep dependencies -> All keeps the nodes with an incoming or outgoing edge to the selected node in the graph and filters all other information. Filter -> Keep incoming dependencies -> All and Filter -> Keep outgoing dependencies -> All are variants of this feature. The filter can be further configured by selecting a particular type of dependency, for example, keep only the incoming method calls.
  • Filter internal dependencies and entities: To focus the analysis on the dependencies between packages and classes the gory internal details of these packages and classes can be filtered by using this feature of DA4Java. Select the node in the graph and from the context menu select Filter -> Internal dependencies.
  • Undo/redo: Each filter and add action in DA4Java can be undone and redone.
  • Toolbar: The DA4Java toolbar provides shortcuts to export the graph in various data formats, zooming, add and filter selected entities, undo/redo, layout, and layout configuration.
  • Visibility: Using the Entity and Association Visibility views the user can hide/unhide entities and associations of selected types. Note that entities/associations are not removed from the graph. * Visibility: Using the Entity and Association Visibility views the user can hide/unhide entities and associations of selected types. Note that entities/associations are not removed from the graph.
  • Birdseye View: Shows an overview of the current graph that can be very handy to navigate large graphs. On MacOS I have noted some problems with the update of the Birdseye View. Switching editors/views will call the update of the view.
  • Polymetric Views: Enables the mapping of source code metrics onto graphical attributes (size and color) of graph nodes. Note, the computation of the metrics can take a very long time for large graphs. I recommend to use this feature only for small graphs.

Publications

  • A Tool for Visual Understanding of Source Code Dependencies (pdf)
    Martin Pinzger, Katja Gräfenhain, Patrick Knab, and Harald C. Gall
    In Proceedings of the International Conference on Program Comprehension (ICPC), short paper, pp. 254-259, IEEE CS Press, 2008.

User feedback

Your feedback is welcome. Please send it to DA4Java: User Feedback

Change Log

2.0.0.201212061552
  • Updated to Hibernate version 4.1.8
  • Fixed problem with MySQL 5.5 when storing FAMIX models
  • Fixed problem with swt-awt bridge on MacOS
2.0.0.201011121416
  • Provided Famix Metrics (incubation!) as separate feature
2.0.0.201009281548
  • Added Polymetric Views
  • Added Bird's Eye View
  • Added support for in-memory database (H2)
Version 2.0.0
  • Added support for class templates and enums to the FAMIX Importer plug-in
  • Fixed bug with storing FAMIX models

Copyright and Licensing information

The use of DA4Java is restricted to non-commercial purposes (research, teaching, student projects, courses and application development). See also the licensing information below.

DA4Java has been developed with the yFiles graph library version 2.5, hence, is subject to the yFiles academic license.

Copyright is by Martin Pinzger, Software Engineering Research Group, Alpen-Adria Univserity Klagenfurt and s.e.a.l., University of Zurich. All rights are reserved by Martin Pinzger, Software Engineering Research Group, Alpen-Adria Univserity Klagenfurt and s.e.a.l., University of Zurich.

Topic revision: r6 - 2013-12-13 - MartinPinzger
 

Copyright © 2012-2017 by the Software Engineering Research Group, University of Klagenfurt, Austria