# Design of related modules wrt pkg

**URL:** <https://discourse.julialang.org/t/design-of-related-modules-wrt-pkg/48708>\
**Category:** General Usage\
**Tags:** question, pkg, module\
**Created:** [October 20, 2020, 9:24pm UTC](https://discourse.julialang.org/t/design-of-related-modules-wrt-pkg/48708 "2020-10-20T21:24:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkarikom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkarikom/32/7096_2.png) [@mkarikom](https://discourse.julialang.org/u/mkarikom)\
**Post date:** [October 20, 2020, 9:24pm UTC](https://discourse.julialang.org/t/design-of-related-modules-wrt-pkg/48708/1 "2020-10-20T21:24:59Z")

</div>

tldr:

1. regarding use of pkg, are these two examples both doing the same thing (one parent pkg exports functions from all the others)?
2. is there case where one might instead do: each child pkg uses functions from a common parent ([DifferentialEquations.jl](https://github.com/SciML/DifferentialEquations.jl) has this relationship with [DiffEqBase](https://github.com/SciML/DiffEqBase.jl), but in general does not use this model)

Sorry this is a bit open ended, just looking for a bit of clarification on two examples of ‘hierarchical package design’ that seem to have different implementations of `using`, and when to use which:

ex 1: [DifferentialEquations.jl](https://github.com/SciML/DifferentialEquations.jl/blob/master/src/DifferentialEquations.jl)

```julia

module DifferentialEquations

  using Reexport

  @reexport using DiffEqBase
...
  import DiffEqBase: solve
...
end

```

ex 2: [FinEtools.jl](https://github.com/PetrKryslUCSD/FinEtools.jl/blob/master/src/FinEtools.jl)

```julia
module FinEtools
...
using .FTypesModule: FInt, FFlt, FCplxFlt, FFltVec, FIntVec, FFltMat, FIntMat, FMat, FVec, FDataDict
# Exported: basic numerical types, type of data dictionary
export FInt, FFlt, FCplxFlt, FFltVec, FIntVec, FFltMat, FIntMat, FMat, FVec, FDataDict
...
end

```

background:  
I have one body of code with fairly specific functionality and several more bodies of code that use this functionality, but otherwise have very different dependencies (one even has c code wrapped), I want to package these as separate modules for maintainability.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [October 21, 2020, 2:37pm UTC](https://discourse.julialang.org/t/design-of-related-modules-wrt-pkg/48708/2 "2020-10-21T14:37:31Z")

</div>

> [@mkarikom](#):
>
> I have one body of code with fairly specific functionality and several more bodies of code that use this functionality, but otherwise have very different dependencies (one even has c code wrapped), I want to package these as separate modules for maintainability.

Just put the shared code in a third module/package and have both of the other packages use it with `using`.
