Organizing Your Julia Code

by Martin D. Maas, Ph.D

Julia has several tools to help you organize your code

In the following sections of this tutorial series, we’ll discuss what we need to know about how to organize Julia code.

The task might seem overwhelming at first, given the large number of concepts, tools and features. So the first thing to do, of course, is to be able to set up a basic workflow, and add features as needed.

If you are reading this, you are probably at least familiar with the worflow of writing Julia scripts, and leveraging the REPL.

One step above the humble monolithic single-file script is a being able to split your code into multiple files. For example, once you have several functions that fall within a somewhat similar topic, you can simply move those functions to a second file, and include this second file in your script file.

include("my_functions.jl")

This is the most simplistic way to organize your code using multiple files, and it can go a long way.

In the next sections of this chapter, you can learn what environments are, how to set up a project, how to automate testing and documentation, and how to organize even larger code bases with local packages, how to collaborate on existing packages, and more!