Elixir

Elixir, a functional programming language created in 2012 by José Valim, is built on top of the Erlang virtual machine. Though still considered a niche player among programming languages, Elixir is quickly gaining popularity for its many advantages and ease of use.

What is Elixir?

In 2014, v1.0 was released and the first elixir conference was held with under 100 people in attendance. Today, v1.9.2 is in use and the annual Elixir Conference hosts thousands of people with attendance growing each year. Elixir is considered a mature language and feature-complete, meaning the language itself is set, with only minor optimizations released.

What Makes Elixir Unique?

José wanted to explore the use of concurrency in programming, which allows multiple computations to happen in parallel. Elixir takes advantage of multi-core processors in most computers today. This means processing can scale to use all available resources on a machine automatically. Another unique characteristic of Elixir is that it uses pattern matching, which allows for the matching of simple values, data structures, and functions. Think of pattern matching as a very advanced if statement or switch case statement, which is a very powerful tool.

What is Phoenix?

In 2015, Phoenix was introduced and is now the go-to framework for creating web applications with Elixir. Similar to Rails, Phoenix uses a server-side model-view-controller (MVC) pattern and builds on Elixir’s philosophy of developer productivity and speed. Phoenix layers consist of Cowboy, the default web server, Plug, the specs for constructing modules for building web apps, and Ecto, a language for reading and writing databases.

Why Do Engineers Love Elixir and Phoenix?

Tools created for Elixir have improved day-to-day development and productivity and allow engineers to set up new web applications fairly quickly. Elixir and Phoenix have first-class build and release tools; package management, project scaffolding, testing, and documentation are all available out of the box. Elixir engineers also benefit from tools built for Erlang, like Observer and Dialyzer.

For a software engineer with Ruby experience, the Elixir language is fairly easy to pick up and learn on the job. Compared to Erlang, syntax is much simpler making it more accessible. Additionally, the community of engineers who work in and maintain Elixir is supportive, approachable, and collaborative, which makes finding resources and answers easier. 

Why Did Revelry Start Using Elixir?

Luke first discovered Elixir while building an autopilot for his sailboat, since he had heard Elixir was really good for concurrency. He asked if he could use Elixir in projects at Revelry, which got Joel and Robert interested. Soon after, Bryan Joseph joined the team; Bryan was an early contributor and author of Elixirscript

Many talented engineers with a Ruby on Rails background find that learning Elixir and Phoenix is typically a fairly smooth transition due to similar controller, router, templates, and database models. Pattern matching, once learned, can be very useful and makes for cleaner code. Each process can be collected independently, so if something goes wrong with one process, then it doesn’t take everything down. 

From a technical standpoint, functional programming languages are inherently easy to write tests for and the apps can be horizontally scaled naturally. For us, more testing means fewer bugs and a more scalable codebase, which allows the app to grow with less refactoring and maintenance work. Elixir, Phoenix, and Live View perform so well at serving pages, that we find ourselves writing less frontend JavaScript in order to make the page feel snappy and responsive. 

What’s next for Elixir?

Eventually, Elixir will be compiled to use with web assembly, which makes it a potential JavaScript replacement. As the community of Elixir engineers grows, so will the list of companies building their products with Elixir, This will, in turn, determine the direction the language goes. Elixir is designed to scale so that hundreds of thousands of machines can talk to each other. There’s truly no limit to how far and wide Elixir can grow.

Kubernetes, Delivered

Deploy your first app within 24 hours. Book a demo to get started.