Skip to content
Jens Schauder edited this page Sep 5, 2013 · 11 revisions

This page is deprecated and will go away. It got replaced by the official documentation of Degraph.

The following images are created (and can be recreated by yourself) by

  • downloading degraph
  • unzip to a directory ( theDir )
  • open a console and change into theDir/degraph/bin
  • execute degraph -f ../example/example#.config with # replace by one of the digits 1, 2 or 3
  • open the resulting `example#.graphml' in yed, opening up some of the nodes and applying an hierarchic layout.

If you open the images in a separate tab you can see an even larger version, where you can read all the labels.

The structure of Degraph

Configuration File

output = example1.graphml
classpath = ../lib/degraph-0.0.2.jar
exclude = java
exclude = scala
part = {
    de.schauderhaft.*.(*).**
}
lib = {
de.schauderhaft.(*).**
*.(*).**
}
internalExternal = {
    internal de.schauderhaft.**
    external **
}

Note that there are two simple excludes for filtering out scala and java core libraries, but other libraries show up in the diagram, although they are not part of the analyzed jar, but referenced from the jar

There is a separate wiki page explaining the configuration file format

Result

Diagram of the structure of Degraph as created by Degraph

Degraph is rather boring to look at since it is rather small and also has a very clean package structure (after all it is a tool for managing package structure). So lets look at a more interesting example.

Overall structure of Log4J

Configuration File

output = example2.graphml
classpath = ../lib/log4j-1.2.16.jar
include = log4j
part = {
    org.apache.log4j.(*).**
}

Result

Diagram of the structure of Log4J as created by Degraph

As you can see the diagram is rather large. But two parts seem to be very important: helpers and spi there are lots of arrows to and from those nodes. So lets have a closer look at those, by filtering out everything else

The spi and helpers packages of Log4J

Configuration File

output = example3.graphml
classpath = ../lib/log4j-1.2.16.jar
include = log4j.spi
include = log4j.helpers
part = {
    org.apache.log4j.(*).**
}

Result

Diagram of the structure of the spi and helpers packages of Log4J as created by Degraph

For this diagram I expanded all the nodes, to see the details of the cycle between the two packages.

As one might have guessed the helpers package contains all kinds of stuff. If this get separated into specific packages one can easily reduce the cycles between the two packages. For example LogLog seems to be some basis implementation or interface used by the the spi while OnlyOnceErrorHandler, QuietWriter, SyslogQuietWriter and CountingQuietWriterseem to be some implementations of an interface provided by spi. It might be a good idea to move these two things into two more specific packages.