Frequently Asked QuestionsThe diagrams show too much!By default, Hairball shows all dependencies - including primitives, Strings etc. To limit what gets shown, use the -includePackages option - for example, to only show dependencies from packages org.myprog.util and org.myprog.logic, run with the flags -includePackages org.myprog.logic,org.myprog.util. What types of dependences can Hairball track?Right now Setter and Constructor injection, and some singleton implementaions dependencies are supported. What is Setter Injection?A dependency that is provided via a setter method, e.g.: public class SomeClass {
private Dependency dependency;
public void setDependency(Dependency dependency) {
this.dependency = dependency;
}
}
Frameworks like Pico and Guice support injection via an arbitrary method tagged with the relevant attribute. Right now Hairball looks for methods prefixed with set only, although eventually the code will be advanced enough to pick up other types of setter injection. What is Constructor Injection?A dependency is passed into an object via a constructor, like so: public class SomeClass {
private Dependency dependency;
public SomeClass(Dependency dependency) {
this.dependency = dependency;
}
}Is one type of dependency any better than another?Well, it depends. Hairball is a tool, and it is up to you how you use it. It doesn't make any judgements about whether or not your inter-class dependencies are good or not. Using Singletons (well, any static state) can make testing problematic. It is up to you if that is an important consideration or not. Setter injection allows dependencies to be changed after object creation. Not only does this mean that you are not sure if an object can be used after creation, it also means you might have to handle dependencies changing during the lifetime of the object. This can be handy though, especially if you are using this to enable on the fly configuration of the object. Constructor Injection when used properly can ensure that you know the object is full created and therefore useable after construction, which can simplify use. Are dependencies to all classes tracked?Right now Hairball programatically excludes all classes in the java package. Eventaully this will be configuable by the user. Does Hairball track Guice or Pico attribute injection?Not right now - although support is planned. Why use GraphML and Dot and not some other graph format?Dot is easy to work with, and allows easy scripting of automatically laid out diagrams using the Dot and Neato command line tools. It does have it's limitations though. It cannot handle realy large images (although it would be better to say that quite often images viewers cannot handle the large images it can produce). yEd is a fairly good graph editor - but the general viewing features are more interesting, and make it possible to work with larger diagrams, and more importantly easily customise how they are laid out. The one drawback is that it isn't possible to script how they are laid out, as although yEd is free, and API which ccould be used to script it (yWorks) is commercial. Prefuse was looked at as an alternative to using yEd and GraphML, but Prefuse didn't seem to be that intuitive. It certainly may be of use in the future though.
|