The Why of Elixir

Learning a new language (and a new paradigm: functional programming) can be a lot to take on. That’s why I thought I’d write a short post on why learning Elixir would be a valuable use of your time. In particular, I will go over the various strengths that the Elixir ecosystem has as well as some major benefits. Let’s start with reliability.


I was recently watching a video by Jonathan Blow (the game developer) and he mentioned how there used to be a concept in tech called “five nines”. What that meant was that a particular service would be “available” (for some definition of the word) 99.999% of the time. Elixir can help you to achieve these numbers using something in the language known as “supervision trees”. Basically what this means is that, if Elixir encounters some error situation, it can simply crash the process and expect the process’s supervisor to either restart the process or handle the crash in an appropriate way. This means that, effectively, if you program things correctly, your application will have very little “downtime”. As you can imagine, this does wonders for your app and is a big reason to learn and use Elixir.

Next, let’s look at parallelization.


If you are coming over from Javascript, you might already be familiar with asynchronous programming using Promises. Elixir takes a different approach to parallelization: it uses lightweight processes which can send messages to each other. Basically what this means is that any time you want to start something in the background, you can spawn up a process and send it any message you want. The flip side of this is that the process can also send (asynchronous) messages back to the calling process. What this effectively means is that you can write your code synchronously, then split out the necessary bits into its own process. This makes it easy to both read and write Elixir programs that utilize multiple cores of your machine without the added hassle of callbacks or promises.

Next, let’s look at extensibility.


If you’ve programmed in a Lisp (or a C derivative) before, you may be familiar with the concept of a macro. A macro is essentially code that writes code. The reason I mentioned Lisp is that Elixir, though it can look similar to Ruby, actually makes use of macros internally. Essentially, Elixir code only looks like Ruby because it uses some syntactic sugar to hide its Lisp-like structures. I won’t go into too much detail here, but if you are really curious about this aspect of Elixir, I would give Chris McCord’s book, “Metaprogramming Elixir” a read.

Next, let’s get to the probable reason you are reading this arcticle: Elixir helps you to minimize the amount of Javascript you have to write.

No Need To Write Javascript (TM)

I would be remiss if I were to write an article about Elixir without mentioning Phoenix and LiveView. Phoenix is basically a Rails- or Django-like web framework written in Elixir. If you’re not familiar with web frameworks, they are a bit too complicated to go into in detail here, but I will just say that they help you to write and organize code meant for serving browsers web pages. What really piqued my interest when learning Elixir was that Phoenix has an addon called LiveView which lets you write interactive pages without the use of Javascript. Basically, all you do is write Elixir code that handles events on the page, and you’re good to go!


So those are some of the benefits of learning and using Elixir. If you enjoyed this post, feel free to Buy Me a Coffee. Your support helps to offset the cost of running this site and never goes unappreciated.

Thanks for reading!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: