24th January 2021
Elixir is a dynamic functional programming language that runs on the Erlang virtual machine.
In this post I will outline my reasoning for learning Elixir and document the resources used in the process. I will update the Books, Videos and Blogs section as I move through the learning process.
With Golang currently the most popular functional language in the network automation space, why would someone invest time in Elixir?
I'm not much of a conformist. I naturally tend to gravitate to the abnormal. I find this personality trait a factor in my decisions of alot of things I do. This is not the main reason though.
With that said, here are some of the reasons I am digging into Elixir.
The Elixir syntax is inspired by Ruby. I really like Ruby. It's probably my favourite language. There is something about it that just meshes with my way of thinking. That was the initial reason Elixir appealed to me.
Elixir is a 'dynamic' functional language. Which basically means you dont have to declare the types of things.
Functional languages are all the rage these days so Elixir ticks that box. I like the idea of passing messages between functions, rather than inheriting the state of an object.
Eixir code gets compiled to a beam file that is run on the Erlang VM. This hopefully avoids runtime errors that you get with languages like Python and Ruby.
Concurrency is a core feature of the language. Elixir code runs in lightweight isolated threads. All CPU cores are used and because processes are isolated, they can be garbage collected independently.
Elixir uses supervisors to restart parts of an application when an error occurs. Thus avoiding crashes of the application.
There is a pretty good number of Elixir projects out there. Elixir is also Erlang compatible, so you have access to Erlang libraries as well. I will do another post tracking Elixir projects that are useful for network automation purposes.
There is a really nice ecosystem of tooling available to make developing in Elixir a great experience. Some I have encountered so far.
- IEX - A REPL for interactive running of code
- Mix - Similar to Rake in Ruby land, has helpers to develop, compile and publish packages
- Hex.pm - Package manager similar to rubygems.org or PyPi
- ExUnit - The default test framework for Elixir
The final tipping point for me was looking through the code of existing projects. The code looks for want of a better word ... Elegant. How it's organized, how succinct it is without being impossible to understand. This made me want learn and use Elixir.
- Elixir in Action, Second Edition - Sasa Juric
- The Little Elixir & OTP Guidebook - Benjamin Tan Wei Hao
Elixir looks like its Fast, stable and most of all fun language. I'm really looking forward to digging into the language and update this post as I do.