Lumenary CS · Programming languages
Julia
A fast, dynamic language for science and engineering, built around multiple dispatch so that code reads like the mathematics and runs close to the speed of C.
Julia is a high-level, dynamically typed language designed for numerical and scientific computing. Work on it began at MIT in 2009, it was announced in 2012, and version 1.0, with its promise of stability, arrived in 2018. It was built to end the two-language problem, in which scientists sketch an idea in a convenient language such as Python, MATLAB or R and then rewrite the slow parts in C or Fortran. Julia compiles each function for the types it is actually called with, so a short, readable program can run at speeds close to compiled C. Its central idea, multiple dispatch, lets independent packages share types and functions in a way that has made its ecosystem unusually composable. It is used for differential equations and simulation, optimisation, climate and astronomy, pharmacology, economics, and machine learning research.
This course takes you from a first program to the way experienced Julia programmers work: types and control flow, functions and multiple dispatch, arrays, broadcasting and linear algebra, your own composite and parametric types, writing fast code, modules, packages and tests, macros and metaprogramming, and parallel computing, ending with a simulation project. It assumes the Start level of Lumenary CS or equivalent experience: you know what a variable, a loop and a function are. Some school algebra helps; no previous Julia, and no linear algebra beyond what the lessons explain, is needed.
To run the programs, install Julia with the official installer, juliaup, following the instructions at julialang.org/downloads; it keeps Julia up to date and lets you switch versions. Julia has no official online playground, so you work in its REPL or run scripts with julia file.jl. Every program marked as checked was run by Lumenary's test suite with Julia 1.13 and its standard library only; examples that use registered packages such as DataFrames or Plots are shown as plain code and explained. The lessons were drafted with AI assistance and are awaiting review by a human computer scientist.
- Chloe · The Designer
“Why is the language built this way?” - Margaret · The Profiler
“What does it print, and what does it cost?” - Gideon · The Language Lawyer
“What exactly does the language guarantee?”
Foundations · 4 lessons
The core language
Why Julia exists and how to work in its REPL, then numbers, types and control flow, functions and multiple dispatch, and arrays, broadcasting and linear algebra.
- 1First steps in JuliaThe two-language problem Julia was built to solve, how to install it, and your first hour in the REPL. 50 min
- 2Types, values and control flowJulia's numbers and its tree of types, what type annotations really do, and the loops, conditionals and comprehensions you will write every day. 55 min
- 3Functions and multiple dispatchEvery way to write a function in Julia, and the idea at the centre of the language, choosing code by the types of all the arguments. 60 min
- 4Arrays, broadcasting and linear algebraJulia's multidimensional arrays, the dot that applies any function element by element, the LinearAlgebra standard library, and the other collections you will reach for. 60 min
Practice · 3 lessons
Building real programs
Your own composite and parametric types, the habits that make Julia code fast, and organising code into modules, packages and tested projects within the wider ecosystem.
- 5Composite and parametric typesDefining your own types with struct, constructors that protect invariants, parametric types that stay fast, and the interfaces that plug your types into the whole language. 65 min
- 6Writing fast JuliaType stability, global variables, allocation, memory order and compilation latency, and how to measure before you optimise. 65 min
- 7Modules, packages, errors and testsOrganising code into modules, managing reproducible environments with Pkg, handling errors, testing with the Test library, and a tour of the package ecosystem. 65 min
Professional · 2 lessons
Julia as professionals use it
Code that writes code with expressions and macros, then threads, tasks and distributed computing, brought together in a complete simulation project.
- 8Metaprogramming and macrosJulia code as data, expressions you can build and transform, macros that rewrite code before it runs, and when not to use any of it. 60 min
- 9Parallel computing and a simulation projectTasks, threads and processes in Julia, how to share data between them safely, and a complete heat-diffusion simulation that brings the whole course together. 75 min
Further reading and resources
- The Julia Programming LanguageThe official website: downloads, news, the blog, community links and the list of learning resources.
- Julia documentationThe official manual, the reference for Base and the standard library, and developer documentation. Julia has no separate formal specification: the manual and the reference implementation define the language.
- Pkg.jl documentationThe manual for Julia's built-in package manager: environments, Project.toml and Manifest.toml, and registries.
- juliaupThe official Julia version manager and installer for Windows, macOS and Linux.
- The General registryThe default registry that Pkg installs packages from, with the record of every registered package and version.
- Julia DiscourseThe community forum, where users and core developers answer questions.