[Case 1] Solving packaging problem by inverting dependencies #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This seems to be the simplest solution. I changed no code, only structure and naming. If the default implementation of the algorithm,
DefaultPvModuleLayouts
, depends on lower level details in a subpackage, then they are not really lower level details. In fact,DefaultPvModuleLayouts
is supposed to be in a lower level, because it depends on everything and nothing depends on it. Therefore:pvmodulelayouts
package.DefaultPvModuleLayouts
into a subpackage. I propose to call itdefaultlayouts
for the default algorithm. Presumably you will need alternative algorithms, they can be put into other subpackages, and they can depend on the same layout specifications in the parent package.If this is a library, then this is enough, and you can have even stricter rules than the three proposed. Instead of "packages should never depend on sub-packages", you can introduce "packages can only depend on superpackages (no sibling dependencies)". If it's a runnable app, however, then you need a place which ties the whole app together, there is no way around that. I usually introduce an
app
package at the root of the project, representing the application fully assembled from all disparate parts from all packages, but since your package structure already hasapp
, I introducedappconfig
, similar as in your solution PR.