dependency-analysis-gradle-plugin icon indicating copy to clipboard operation
dependency-analysis-gradle-plugin copied to clipboard

Provide modularization advice based on dependency information

Open alllex opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe.

In larger projects, it often happens that certain modules accumulate classes that are not necessarily tied into a coherent group. Rather, classes may be added to such a module only because many other modules already depend on it, and it makes it easier to "expose" the new class to the desired dependants. Or such "bloated" modules exist in the build for historical reasons.

Modularization (splitting larger modules into smaller ones) can have many benefits, such as better compilation times and more cache hits during the build process. However, often times it is not trivial with where to start that modularization process.

The dependency analysis on the class level may contain enough information to find places where the build structure is ready or almost ready for some modules to be split.

Describe the solution you'd like

The plugin provides a new task. The task is responsible for finding classes that, when moved to another module, would allow the dependencies of their dependents to be "lighter."

For instance, if many modules depend only on a few classes from a large module M, then when these few classes are moved to another module S, the dependencies of those many modules could be changed to just depend on S instead of the whole M.

Describe alternatives you've considered

Additional context

alllex avatar Jun 25 '24 16:06 alllex

I'm "about"(tm) to write a blog post on modularization; which is why I clicked on this issue. This creates some levels of concern without more information though. I imagine such a thing would advise simply creating a "layer" (horizontal) architecture, e.g Infra/DAL/Model/Controller. It would probably advise against feature splitting (verticals). I personally favor doing both, and one should do so from the start of a project, lest you slow yourself down later.

Given a project I worked on a while ago where we had the layers wrong, I can only imagine this feature would have advised us incorrectly to pull a layer down, and we needed to push it up to stop causing problems.

I guess to help anyone that does work on this... given some examples what would be the output? How do you prevent suggestions to move things to in-appropriate slices? how do you prevent making what is probably already a problematic architecture worse.

xenoterracide avatar Sep 17 '24 20:09 xenoterracide