This article is not technical and highly opinionated!
What is Elixir?
Elixir is a functional programming language built on top of Erlang Virtual Machine. Think of Elixir to Erlang as Scala to Java. Erlang was designed and implemented at Ericsson in the 80s. it is used to build scalable, fault-tolerant, distributed, non-stop applications. Erlang has been used by the telecom industry for over 20 years, so, it has a proven record in production. Elixir inherited all the goodness of Erlang with a much elegant and easier syntax.
CPUs are not going to be faster, instead we have multiple cores. Obviously, our code must be concurrent to be able to utilize all the cores sufficiently, and here’s where Elixir shines.
Instead of relying on the operating systems concurrency, Erlang virtual machine built its own concurrency model which is based on the Actor model where processes communicate with each others through message passing, hence Erlang is a concurrent language in its core. So, by adding more CPUs to your machine, Erlang is going to utilize them and your application is going to be faster.
An application built in Erlang can:
Handle very large number of concurrent activities
Be easily distributable over a network of computers
Be fault-tolerant to both software and hardware errors
Scale with the number of machines on the network
Be upgradeable and reconfigurable without having to stop and restart
Be responsive to users within certain strict timeframes
Stay in continuous operation for many years
Love at first sight
A couple of months ago, one of my colleagues asked me if I know anything about Elixir. All what I knew back then was that the Ruby community was talking about a new programming language called Elixir. That's when I decided to give it a look.
At the beginning, the code looked much like Ruby, I was able to see a lot of similarities. But when I started learning Elixir and tried writing some code, I found out that it is not that easy. The concepts of functional programming for someone who has been using OOP throughout his career is very hard to grasp in a couple of weeks.
The hard part here is that I had to unlearn all the things I learnt! It's totally a different way of thinking and you will need time to get used to it.
The Elixir official tutorial is a good place to start, but it's not enough. I tried exercism.io and then I realized that I need to go back and re-read the tutorial once again. The exercises and the solutions on exercism.io was a great way to learn and practice Elixir.
Then I had a look into Phoenix (web framework built on Elixir) which looks like Ruby on Rails although Phoenix creator says it is not! The framework is super fast, but I had troubles with their documentations. Back then Ecto 2.0 was not yet released and it was very hard to learn about it. At the end I was able to do what I wanted to do with Ecto but it took too much time and effort due to the lack of good tutorials and documentations.
From what I read and watched, I can say that Elixir/Phoenix mostly are going to make the same impact that Ruby/Rails did 10 years ago. But the question is should we start using them now in production?In my opinion, you must start learning about Elixir. There are a lot of different concepts you will learn about, that will make you see things differently. But using it in production is something else. The first challenge is that not all members of your team will be able to learn it easily. I am not talking about the syntax here. Elixir is a pure functional programming language, we are not dealing with objects, instead we are dealing with immutable data. We are not thinking of changing the state, instead we are thinking of data transformation. This switch may take time. Second challenge is the lack of documentation for some of the 3rd party packages. Third challenge is that the community is still growing.
So, what to do?
I think for now the best things to do are to keep learning Elixir, make small pilot projects or maybe try to contribute if possible.