I am refactoring a large codebase where most of the classes are located in one package. For better modularity, I am creating subpackages for each functionality.
I remember learning somewhere that a package dependency graph should not have loops, but I don't know how to solve the following problem:
Figure is in package
Layout is in package
Layout requires the figure to perform layout, so package
layout depends on package
figure. But on the other hand, a
Figure can contain other
Figures inside it, having its own
Layout, which makes package
figure dependent on package
I have though of some solutions, like creating a
Figure implements and putting it in the
Layout package. Is this a good solution? Any other possibilities?