Elixir is a modern functional language, built on the basis of Erlang (in fact, it uses the Erlang virtual machine) as a more approachable alternative. It’s scalable and fault-tolerant, perfect for projects where efficiency and minimising costs are important. We’ve spoken to Bartosz, iRonin’s Elixir expert, about his adventure with the language, starting with his learning process and ending with what he appreciates the most about Elixir.

Elixir is a dynamic, functional programming language created to “get the job done”. It steers clear of academic discussions and the concept of language purity. The main focus of Elixir’s creators was to build a language that would make writing highly concurrent and fault-tolerant code easier. Elixir was also designed for building scalable and maintainable apps from the get go.

Starting out with Elixir

Bartosz started out as a Ruby on Rails developer, but curiosity and the desire to learn pushed him in a new direction. He found Elixir by accident, and became fascinated with is as he got to know the language. He began with a very basic tutorial, which taught him the syntax and semantics of Elixir, and helped him make the shift from objective to functional thinking. After that, he worked with some books (on Elixir and Phoenix) and learned by creating his own apps.

“I had a lot of fun,” he says. “Elixir continued to surprise me, showing me how certain things can be achieved much more easily than I had thought. However, it required a change of mindset from the objective to the functional paradigm, which can be a big step for many people.” For Bartosz, it was not too difficult to make.

It was inevitable that he would interact with the Elixir community, which is usually focused around elixirforum.org, the official forum. “It’s a very mature community. Many of the discussions focus on software architecture and topics not related directly to Elixir,” says Bartosz. It’s an open community, too - open to dialogue, and unlikely to reject anyone for their views. Even those who are very critical towards Elixir. The community doesn’t limit itself to Elixir, either, which is a fantastic approach. They believe in using the right tool for the job, rather than blindly believing the language you love is the ultimate choice.

The reason behind this maturity might be that Elixir devs are experienced people - a junior-level Elixir developer would be difficult to find. Most current Elixir experts started out similarly to Bartosz - by switching from another language, which they had already used professionally.

What does Elixir do?

Companies using Elixir enjoy many benefits, such as its scalability. The language also allows teams to lower their costs, particularly when they spend a lot on infrastructure. A less obvious benefit is the ease of finding truly engaged, mature developers. As we already mentioned, Elixir is not (yet) a mainstream language, so people who know and use it are driven by the love of technology and passion for programming. Almost all of them are experienced professionals, or hobbyists with many personal projects under their belt.

The pros and cons of Elixir

We’ve already touched upon this, but it’s important to understand the trade-off you might be making if you choose Elixir for your project.

Pros:

  • A lot can be done without adding any external tools - Elixir provides most of what’s needed to build a fully functional app. Many basic libraries are built into the language.
  • All Erlang libraries are available for use out of the box.
  • The language works in all contexts where Ruby on Rails and equivalent solutions would work, and it’s better at some things (e.g. scalability).
  • Elixir offers great concurrency, which is one of its main advantages.
  • The language is highly fault-tolerant, which allows particular services within an app to be restarted with a known working state should a bug occur. This means that an entire app won’t just stop working suddenly, giving developers time to identify and fix the issue.

Cons:

  • There aren’t too many Elixir devs out there, so building a team can be tricky.
  • Fewer specialized libraries usable for Elixir are available, compared to other languages, because of how young Elixir is. These libraries simply haven’t been created yet.

Elixir’s main competitors

Whether or not a language can be seen as competing with Elixir depends on what project it might be used for. Still, there are a few languages often chosen for projects for which Elixir would also be a great solution.

Ruby
Ruby is actually the better option when you have less experienced developers on your team. And we don’t mean bad devs, just ones with a lot of potential and talent that want to learn and grow quickly - and learn along the way as they work. Because of the number of resources for Ruby, the language offers a fantastic learning environment, while also helping the team by speeding up work and making it easier (through many ready to use, existing solutions and libraries). Elixir can also use all Erlang libraries out of the box, but Ruby’s trove of resources is larger.

When timing is critical and building an app quickly is the top priority, Ruby and Rails are definitely better for a less experienced team. Elixir and Phoenix are fast to use, too - in the hands of experts who know how to use their advantages. Thanks to Elixir’s fault tolerance, a development team can focus on building an amazing app quickly, knowing that the threat of a system wide outage is minimal. Errors won’t affect the application as a whole, just its isolated parts - which can be repaired without influencing the app’s uptime.

Go
This language is better for number-crunching apps that do a lot of CPU-heavy calculations like sound or image manipulation, for example. Go excels where performance is the top priority, and is CPU bound.

Elixir and Erlang, on the other hand, are more comparable to a whole operating system in which many apps are ran concurrently, which also improves performance, but in a completely different way. To help you visualize the difference: Go would be the tool to speed up those highly specialized small applications running in the Elixir/Erlang environment.

Conclusions

Elixir offers many benefits to those who decide to use it. It takes the best from Erlang and helps development teams introduce high concurrency and scalability to their projects. It has a lot of built-in tools that allow for fast development in the hands of an expert. Overall, Elixir is a great tool, but like all tools, it won’t help you accomplish much without the right people wielding it.

Not sure whether Elixir is the best language for your project? iRonin’s experts have been developing commercial projects for about a decade. Our experience allows us to help clients make the best choices for their business needs.