Is Elixir the next Ruby?

Posted by Christian Noack on 2020-07-27
Words 664 and Reading Time 4 Minutes
Viewed Times

Yes, it is! Thanks for your attention.

Just kidding! Let me explain in detail why I think you should choose Elixir for you next project, if you initially thought Ruby would be a good choice.

The creator of Elixir, José Valim, was a Ruby-on-Rails core team member. It’s no suprise that you find yourself at home in Elixir if you are a Ruby developer. The syntax of Elixir resembles Ruby very much although it is functional. Ruby is not strictly bound to a paradigm, it is a mix of object orientation and script programming. Ruby was developed in 1993 by Yukihiro Matsumoto. It’s matured ever since then. Applications written in Ruby are known to be stable and reliable. Elixir hasn’t got this long heritage. It was created in 2011. Instead, Elixir is built upon Erlang which dates back to 80ies. Concerning reliability, there is no disadvantage for Elixir. Instead, Erlang’s OTP and the Supervisor make Erlang applications very reliable during production runtime. José Valim seems to have picked the good things of Ruby and replaced the bad ones with better implementations. Therefore Ruby and Elixir have astonishing similiarities in many points.


The following example is very simple, but shows the similarities in syntax nicely :

# Ruby
puts "Hello, World"
# Elixir
IO.puts("Hello, World")

If you are used to web application development with Ruby, you will most-likely use Ruby-on-Rails together with ActiveRecord as database layer. In Elixir you’ll use Phoenix and Ecto instead. Both resemble their Ruby-on-Rails counterpart very much. You’ll get used to them quickly. The tooling of your development environment is very similar, as well. In both worlds you have a script for dependency management, starting the application and building it: for Ruby-on Rails it is the rails command together with the bundler, in Elixir it is the mix command.
Both environments provide a very powerful read-evaluate-print-loop: for Ruby-on-Rails this is the rails console, for plain Ruby it’s irb and in Elixir you’ll use iex.

For Ruby you’ll get a huge amount of libraries you can use for your development, many of which are very mature. Elixir is younger, still has a smaller community and there are lesser libraries available, but you can use almost all Erlang libraries in Elixir. There are countless mature libraries available.

It’s not only the similarities with Ruby that make Elixir an interesting option. Elixir has got some major advantages over Ruby.

Advantages of Elixir

Ruby and Elixir both incorporate late-binding and dynamic typing, but whilst Elixir is stricly following the functional programming paradigm, Ruby is more or less a combination of object orientation and script programming. One might think that Elixir’s strict commitment to the functional paradigm leads to restrictions, but instead, being constrained brings many advantages for the development, like clarity of code and easier refactorings. I recommend watching Robert Martin’s contribution to the ACCU 2011 to learn more about the advatages of programming languages which are restricted to one paradigm.
In Elixir you mostly implement pure functional, i.e. stateless and without side-effects. This drastically increases scalability, concurrency, testablity and reliability. Ruby has known limitations in concurrency and throughput. Elixir is based on Erlang’s OTP which is famous for its concurrency features.


There is no useful additional functionality that the object-orientation in Ruby provides you over the functional implementation in Elixir. There is a growing community of software developers who doubt whether OO with all of its encapsulation and inheritance gives any advatages at all. Even Alan Kay stated that his idea of object orientation was in fact more about message passing and not so much about encapsulation and inheritance.
Elixir gives the developer all advantages of Ruby (e.g. over Java) and additionally provides modern functional programming without the huge amount of parenthesis other LISP-based functional programming languages are feared for.