I am developing a package, call it Model
, which consists of a module that defines all the types and functions pertinent to the computational aspect of the codebase. I am also developing some custom plotting and graphics generation functions that are specific to the computations and types in Model
. Currently, I have both the computation and the plotting functionality all under the Model
module, but I am thinking that the plotting functionality has grown sufficiently large and different from the Model
implementation to warrant its own namespace as a dependent package, call it CustomPlots
. Then, I would create a parent package, call it MainPackage
, which would depend on both Model
and CustomPlots
. Since the plotting functions make use of the code in Model
, CustomPlots
would depend on Model
(note that the end user should have access to the exports from both Model
and CustomPlots
). From a good design perspective, is this a valid approach? Are there any issues that could arise with this approach? Is there a reason that making the CustomPlots
functionality a simple include
in the Model
module would be a more preferable approach?
Here is the question written in code:
- Current architecture:
module Model
include("some-computation-code.jl")
include("custom-plots.jl")
export <exports from both "some-computation-code.jl" and "custom-plots.jl">
end
- Suggested architecture:
module MainPackage
using Reexport
@reexport using Model
@reexport using CustomPlots
end
module Model
include("some-computation-code.jl")
export <exports from "some-computation-code.jl">
end
module CustomPlots
using Model
include("custom-plots.jl")
export <exports from "custom-plots.jl">
end