Elixir, BEAM and OTP

As I plan to write and speak about Elixir on my blog and hopefully at some meet-ups soon, I though I would write a short post with handy descriptions of some of the key aspects that I can reference in one place…

What is Elixir?

Think Dave Thomas describes it best…

“The Elixir Programming Language wraps functional programming with immutable state and an actor-based approach to concurrency in a tidy modern syntax. And it runs on the industrial-strength, high-performance, distributed Erlang VM.”

It has very powerful meta-programming capabilities through compile time expansion of macros and the dynamic power of the language. A good example of the developer productivity that can be gained is their use in the routing system in the phoenix web framework. When learning about Elixir macros I found the ‘Understanding Elixir Macros Series’ by Saša Jurić to be very useful.

What is the Erlang VM & BEAM?

The “Erlang VM” is the name of the virtual machine where all Erlang code is executed. Every compiled Erlang file has the suffix .beam.

There is also an implementation of Erlang which runs on the JVM, called Erjang, but I guess the less said about that the better as the Erlang VM is really the awesome part if you ask me.

When you compile Elixir code it is converted to .beam format, which allows it to be executed on the Erlang VM.

What is OTP?

OTP is set of Erlang libraries and design principles providing middle-ware to develop these systems. It includes its own distributed database, applications to interface towards other languages, debugging and release handling tools.

The OTP libraries (and the associated best practices to an extent) are mature, battle hardened and hide much of the boilerplate code required to perform common patterns such as creating a server to store state, recover from failures through supervision trees and so much more.

I look forward to writing about this with examples in future as I learn more about OTP myself.

Where is OTP used?

egitsd – egitd is an Erlang git-daemon implementation that provides a more flexible, scalable, and loggable way to serve public git repositories. It is used by github.com.

RabbitMQ – An open source message broker (sometimes called message-oriented middleware) that implements the Advanced Message Queuing Protocol (AMQP).

More Projects using OTP…