Code organization to use precompilation with a tiny example

I’ve read a few good (and recent) threads on how to organize code to achieve what I need, but I want advice on a really tiny example.

Suppose I’m currently tasked with building a calculator program.

I want to make separate modules for each low level functionality: Adder, Subtractor, Multiplier, Divider.

Then I want to have higher-level abstractions which make use of such modules to make applications (in this case, a Calculator app).

I want to keep low level modules in a place called “BuildingBlocks” and I want to keep Calculator and others in a “Projects” folder.

This structure is important because I want to keep adding different building blocks and making different projects with them. For example, maybe I find a novel way to do multiplication and want to try out that algorithm for a specific problem. Then I want to create a specific calculator app that uses that case.

The main objectives of this example are:

  • To be able to have some people writing building blocks and other people writing “apps”
  • To have the building blocks be precompiled so apps don’t have compilation latency when executing functions for the fist time
  • To have all building blocks previously tested and testable using Pkg functionality


  • All source code is under the same git repository (git submodules may be used, but is a bit of a pain to set up)
  • Git has to be local/locally hosted, with as few plugins as possible
  • Although Julia has multiple dispatch and I can easily define two types for these two multiplication routes, for the sake of the example, I want them to be in different modules/packages.


  • Is there any downside to using this folder structure?
    <git_root>/Projects/Calculator/src/Calculator.jl <git_root>/BuildingBlocks/<Adder/Sub<etc>
  • In Calculator.jl, how do I do “using Adder.jl”?
  • Is there any online tutorial about this topic that is not in pure text? Code snippets and exercises would be greatly appreciated
  • Would it be recommended to create a new Julia environment for each new project in Projects?

Thanks for reaching this point of the post :slight_smile:
I only made a few small coding projects where I create a single .jl file to write functions that solve problems and the problems themselves in some main.jl or runtests.jl.