Juliacon 2024

Natural Science, Computer Modeling and Literate Programming
2024-07-10 , For Loop (3.2)

We present Entangled, a generic tool for maintainable literate programming. Entangled works together with Markdown based documentation tools like Documenter.jl, and ships with a build system for running longer computations. We show an example from the Earth Sciences in a package called CarboKitten.jl, simulating the formation of carbonate reef platforms and their produced limestone stratigraphy.


Computer modeling is a vital tool in the natural sciences. However, often the software packages and scripts used in producing scientific output, live a separate life from the published research output. This is a major concern when it comes to reproducibility of results. There are many techniques for literate programming, mixing computer code and literary prose, that try to address this issue. Examples are Jupyter, RMarkdown and in the case of Julia, Literate.jl and Pluto.jl. None of these solve the issue of code complexity, and their use often results in code that is not well designed, unmaintainable and not reusable.
Entangled is a system for literate programming, based on Markdown, that synchronizes code blocks and plain executable code in two directions. Executable code is tangled from any number of code blocks and code blocks can be stitched back into the markdown when some of the code was edited. This way, the executable code is always the same as which is presented in documentation and we retain the use of IDE features when editing code. Because code is treated like plain text, Entangled is completely agnostic to the used programming language. The resulting code can be reused as any other module.
Because Markdown can be exported to HTML using standard documentation tools (e.g. Documenter.jl) as well as LaTeX/PDF (using Pandoc), Entangled can be used to write documentation, but also completely self-evaluating journal papers.
We show an example from the Earth Sciences in a package called CarboKitten.jl, simulating the formation of carbonate reef platforms and their produced limestone stratigraphy. Though the Entangled tool is written in Python, the focus of the talk will be on how Literate Programming in general can help disseminate superior tools like Julia in the Matlab dominated world of geoscience.

Research Software Engineer at the Netherlands eScience Center with a background in Cosmology and an obsession with Functional Programming.