Say I have 20 classes in my root package. I decided to organize classes by creating 3 subpackages under the root package. Then I put 5 classes in each of the subpackages, leaving 5 classes in the root package (because they are top-level classes). Now, since I need to use classes in subpackages of 5 classes in the root package, I end up making classes in subpackages publicly available, and before the subpackage of these classes will only be exposed to the packages.
The above code organization is done with good recommendations. The subpackage is implemented by function instead of layer. Interdependence in front of packages is minimized. Nevertheless, many classes of subpackages make sense to access from a higher level.
Is there any good practice to solve this type of scenario?
source
share