Introduction to Julia

By Guillaume Dalle

This website contains a series of notebooks illustrating the use of the Julia programming language. It was originally designed as teaching material for students of École des Ponts ParisTech, but it is accessible to a much wider audience.

All of the links in the menu point to notebooks that can be visualized in your browser without any prerequisites. To edit or run a notebook, click on Edit or run this notebook and follow the instructions given there. You will need to install Julia and add the Pluto package. I sometimes had issues with Pluto in Firefox, so you may want to try Google Chrome.

While these notebooks are great for interactive exploration of short code snippets, they have serious downsides when it comes to larger tasks. We strongly advise you to choose another tool for more ambitious projects, ideally an IDE such as VSCode (more on this below).

The basics

What is Julia?

Maybe the solution to the two-language problem (see this Nature article):

  • User-friendly syntax for high-level programming
  • C-level speed (when done right) for high-performance computing

Learning Julia

The Julia website has a great list of resources for beginners, as well as many free tutorials contributed by the community.

If you just need a quick refresher about syntax, this cheat sheet is the place to go. For more involved questions, the primary source of knowledge is the Julia manual.

If you want to go further, here is a list of quality books and tutorials:

Beyond the present website, other students from my own research lab have also worked on interactive tutorials, which you will find below:

Development environment

When coding in Julia, you want to select a comfortable IDE. Here are a few good choices:

Getting help

The Julia community is very active and welcoming, so don’t hesitate to ask for help in the following venues:

Creating a package

Discovering packages

Before coding something, you want to make sure that someone else hasn’t already coded it better and faster than you. Since Julia package names are sometimes obscure, you may need to search for packages on a dedicated database: that’s what JuliaObserver and JuliaHub are here for.

In addition, Julia packages are often gathered into GitHub “groups” or organizations, which are listed here.

If a Julia package doesn’t exist:

…or code / wrap it yourself in Julia and contribute to the community!

Workflow

Some workflow tips can be found in the manual. In particular, you should check out the following packages:

Getting started

The PkgTemplates.jl package enables you to create packages in a standardized way. It takes care of the file structure for you, and even integerates with GitHub Actions or Travis CI to set up a continuous integration workflow.

Style

Julia has no universally agreed-upon style guide like Python. The main official guidelines can be found here.

For an exhaustive style reference, have a look at the unofficial (but widely used) BlueStyle by Invenia.

Unit testing

Julia has built-in support for unit testing. This allows you to check that recent modifications did not modify the expected behavior of your code.

Documentation

If you are courageous enough to write documentation (which you should be), the best place to put it is next to your code using docstrings. Julia docstrings are basically Markdown, see this reference to know how to write them.

If you want to automatically generate a nice HTML documentation website, harnessing the power of Documenter.jl is the way to go. This pakcage also enables testing from within the documentation itself. Inside a docstring, you can put examples of REPL input and expected output, which will be run again and checked for correctness every time the documentation is updated. These code examples are called doctests.