Why do I use Julia?
Introduction
It has been two years since I have started writing this blog. Therefore I thought of composing some more high level post today and share with you my thoughts on why I use Julia.
This post does not aim to give a comprehensive review of strengths and weaknesses of Julia in general. Instead, I want to collect some notes of my story of working with this language (and I think it is important that I am an economist by training, as people with, e.g., computer science background might have different thoughts or expectations).
Starting with Julia
My starting point with Julia was around time when I was finishing my habilitation degree (this is roughly an equivalent of getting a tenure in US). At that time I was implementing a lot of agent-based simulations. Studying such models usually requires quite a lot of computations. The reason is that not only a single simulation run takes time but also you usually need to run these models many times under different parameterizations.
If you would like to learn more how such models are designed and used you can have a look, for example, at this paper where you can find a description of a model and experiments run using it and a link to a GitHub repository with Julia source codes.
So what requirements did I have for a programming language? Here they are:
- it should be fast, and support multi-threading and distributed computing;
- it should be easy to code with, so that the code is short, easy to maintain, and one does not have to constantly use, e.g., Valgrind to debug it;
- it should support interactive development (Julia has an excellent REPL).
Julia fitted these requirements perfectly.
In short: I started using Julia because it solved an important problem I had in my work.
Staying with Julia
Over the years I have started using Julia in numerous projects. Since most of problems I needed to solve involved some numerical computing I rarely had an issue that Julia missed important features. Sometimes indeed Julia lacks some functionality, but, fortunately, then it is really easy to integrate it with C, Python, or R.
Another nice aspect of Julia is that it allowed me over the years to easily collaborate with other non-programmers. You might be surprised by this statement, but there are the following aspects of Julia that make it possible:
- A well written Julia code is easy to reason about (and when working with mathematicians they like that it uses 1-based indexing so the formulas they use in papers can be directly translated to code). This allows readers to both visually verify correctness of the code and to make small changes in its logic if needed.
- If I wanted someone else (non-technical) to run my code I just needed to ask this person to install Julia (this is easy). Next, I shared Project.toml and Manifest.toml files along with my code and Julia took care about proper setup of its working environment. This saved me hours of work that I would otherwise spend on helping my collaborators to configure things properly (or teach them how to, e.g., set-up and use Docker).
After using Julia for a while I decided to start contributing to packages. This is another area where I enjoy Julia a lot. In my early days the selling point was that I found it extremely easy to learn how to create a package, register and release it, set up CI on GitHub, find advice on good coding style or writing tests. The package to which I ended up to contribute most is DataFrames.jl. I have found the community of people involved with this package extremely welcoming, engaged, and knowledgeable. I have learned a lot from them and at the same time I made a lot of friends.
This friendly social aspect of the Julia community is extremely important in the long run. Please do not take me wrong - it does not mean that any PR or issue is just accepted. I would say it is the opposite. Many times the discussions take months of going there and back with the design. The point is that if you feel people reacting to your thoughts are welcoming it is much easier to go through all the obstacles you encounter along the way. In short - in Julia community even though I often felt like this I have never felt like this.
Conclusions
Do I think Julia is one language to rule them all? Certainly not. Different languages have different target audiences, where they shine. However, if you are looking for a language that:
- is easy to use,
- provides a decent interactive environment,
- has a best-in-class package manager,
- is fast (including multi-threading and distributed computing),
- allows you to become a member of a friendly and responsive community from which you can learn,
you may consider giving Julia a try like I have done.
Will you encounter problems or missing features along the way? For sure you will (as most likely you would with any programming language). If you want to see a record of PRs and issues I opened for Julia and how they got solved it is easy to do it here.