Building scalable and maintainable applications with Elixir


Elixir is a dynamic, functional language designed for building scalable and maintainable applications.

It runs on the battle-tested Erlang VM and is underpinned by lightweight processes communicating via message passing. This approach, in conjunction with immutable data structures, allows code to be safely executed concurrently, scaled within and across nodes, and supervised for failures. Fault tolerance in Elixir (and Erlang) applications is achieved by taking an approach to error handling that is completely different to that of most other languages.

In Elixir, errors are accepted as a fact of life (particularly when dealing with networks, file systems, and other third-party resources), and processes are designed to crash when unexpected errors occur. However, processes are isolated, so the impact of crashes is minimised, and supervisors also ensure that the essential processes are restarted in a known-good state.

Elixir was created by José Valim, a wellknown rubyist and alumnus of the Ruby on Rails core team, and its readable syntax will feel natural to Ruby programmers. 

Developers who use the Elixir language will enjoy its modern features and build tools, alongside a set of mature libraries and design patterns that have evolved from the Erlang community’s 20 years worth of experience in building robust applications using the open telephone platform (OTP) framework.

Another strength of the Elixir ecosystem is the Phoenix web development framework, which uses Elixir’s pattern matching and powerful Lisp-style macro system to produce expressive and performant code that can achieve incredible response times (often measured in microseconds).

On the embedded software front, Nerves is an increasingly popular library that packages Elixir applications into a minimal Linux distribution booting directly to the Erlang VM. Rather than dropping down to a low-level systems programming language, developers can enjoy the productivity and robustness of Elixir whilst targeting pretty much any hardware that can run embedded Linux. Since our last round table, Elixir and its ecosystem has continued to mature, with new versions of both the language and the Phoenix framework bringing continued improvements to the developer experience. Particularly interesting in the latest version of Phoenix is the introduction of “contexts” that guide the architecture of applications towards business-domain focussed modules, which offer some of the benefits of loosely-coupled microservices even within a monolithic application. 

Sign up to Badger News