Is there a tool that will look at my Java code, and suggest a good package structure?

StackOverflow https://stackoverflow.com/questions/144392

  •  02-07-2019
  •  | 
  •  

Question

I have a large codebase, and I'd like to refactor the package structure so that classes which interact heavily go in the same package.

It seems that it should be possible to create a tool that could look at the interactions between classes, and then group together those classes that interact heavily. These groupings might then suggest a good hierarchy for packages.

Does such a tool exist? (open source is preferred).

Was it helpful?

Solution

Structure Analysis for Java is an Eclipse plugin that does some dependency analysis:

http://stan4j.com/

OTHER TIPS

Structure101 is another product that can analyze the structure of your code and do dependency and what-if analysis.

http://www.headwaysoftware.com/products/structure101/index.php

You could try Lattix, which uses the Dependency Structure Matrix to show you dependencies and hidden structure within your code at both class and package level. I've found it helpful for this kind of stuff in the past.

http://www.lattix.com/

IntelliJ has some code matrix tools in this direction.

Something that can at least tell you if you're on the right track design-wise is JDepend. It encourages dependency on highly abstract packages (that presumably will change less than packages with code that is less abstract) and will warn you when your packages have circular dependencies. I find it to be a good reality check.

There are numerous ways to use it, including as an Eclipse plugin.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top