views:

157

answers:

6

I have a Java project that I've been working on for a while. The design started out pretty good but slowly degraded as changes were made. I'm looking for some sort of tool that will analyze the project. It'd be really nice to have a map of the dependencies of different classes/methods. I feel like certain methods are only in there to fulfill a very specific goal. I'd like to eliminate unnecessary code and make my design better.

Any suggestions would be great! Thanks!

A: 

Have a look at Apache Ivy

objects
Ivy isn't a bad dependency manager but it doesn't answer his question he is looking for something that will analyze his existing projects dependencies.
Matt
+1  A: 

Doxygen can help, especially with graphical representations of the dependencies between classes and methods.

ChrisH
+1  A: 

This is not a perfect answer, but it may be helpful for quick checks. If you are using Eclipse for your development, you can view the call graph for a method by selecting its name and pressing Ctrl-Alt-H (or right-click and select "Open Call Hierarchy"). You can use the view that opens to see what calls the method, and what methods are called by the method.

Mike Daniels
That helps a lot actually. Thanks!
Ryan
+4  A: 

You may want to check out JDepend. It was specifically developed to solve the problem you are facing.

Working as a consultant it is very common for me to be thrown in to a huge legacy code base. Typically the first thing I do is run JDepend on it to try to get my bearing on the code base and all of the dependencies.

Good luck.

Steve Levine
+1  A: 

There are several good analyzers for Java. I have been playing around with PMD so far and have had decent luck with it.

Matt
+1  A: 

You may also want to try FindBugs. Helps a lot with these and many other issues.

dimitko