I’m wondering if there are any general views on the cleanest way to combine files within a module. I have at present three types: Parent
, Child1
and Child2
. Parent
is a synonym for AbstractArray{Complex}
, and Child1
and Child2
are both struct
s that derive from it. All three types are relatively complex with a whole bunch of associated methods, and all are used within a module called MyModule
. In order to cut down the size of the file MyModule.jl, I decided to divide the three types into separate files, then recombine them into MyModule
.
Now comes my question: Is it more common, or even better, practice to write the files Parent.jl, Child1.jl and Child2.jl as free-floating code that gets included
into the middle of MyModule
, or is it more common/better to package all three of them into individual modules that are then using
-ed into MyModule
?
Following this is the additional question of whether there is a standard practice like in C++ of #define
-ing constants that avoid the issue of including a file twice into the same code. So like, what if Parent
is used by both Child1
and Child2
, then both are included into MyModule
. What is the standard practice for avoiding the Parent
code being included twice into MyModule
.
I have various thoughts on these matters, but I’m a relative beginner in Julia and would be glad to hear from more experienced people.