Why you should take a look at Elixir, the new Dynamic Functional Language.

Why you should take a look at Elixir, the new Dynamic Functional Language.

I have been working with Elixir for a year now, and in my experience it is turning out to be an excellent programming language. You might not have heard about it as its still in its early years but in its few years of existence it has proved itself a very good contender for the future.  In this article I have listed out a few reasons why you should look into elixir.

CONCURRENCY

Elixir is built on top of erlang. The elixir code is compiled down too erlang bytecode and then executed by the erlang virtual machine. Erlang VM is already known for its suppport for concurrency, distribution and fault tolerance.

When you install elixir you also install erlang and erlang otp. As in the docs

OTP is a set of Erlang libraries, which consists of the Erlang runtime  system, a number of ready-to-use components mainly written in Erlang,  and a set of design principles for Erlang programs.

OTP provides modules and behaviours that represent standard  implementations of common practices like process supervision, message  passing, spawning tasks, etc.

OTP employs an actor model, where each core is assigned a thread with each thread has its own scheduler. Previous versions of opt had a single stack for all the threads to share. However the versions available now has a individual queue for each thread thus, greatly increasing the processing speed and concurrency.

iex is the command to bring up kernel which is the elixir's default environment. the [smp:8:8] indicates the number of cores available for uses for elixir process

IMMUTABILITY

Pretty much everything in elixir is immutable. Elixir has a immutable data structure system. This mechanism proves very efficient in handling data throughout the program. By making a new copy of data every time there is a change and changing the copy instead of the original data, We ensure that data is not corrupted on the other side. If there is a need to access data in the data structure then it is converted into a enumerable and then the data is accessed but even then results have to be stored in a different data structures and it will not change the existing data structures. This greatly reduces the corruption in data being handled.

FUNCTIONAL LANGUAGE

Elixir was developed by Jose Valim. He came from a ruby background. Jose Valim developed elixir as a functional language  opposed to ruby, Which is in fact a OO language. Code in elixir is organized into modules with each module performing a specific tasks. The biggest relief while programming with Elixir is that you see what  you get. You need to specify each argument that you want to receive, so  there are no added complications like instance variables. This also  helps avoid the problems mentioned above, where some other part of the  system might manipulate the data in another random place.

REAL TIME COMMUNICATION

Elixir has a concept of channels for comunication. Each connection to a channel spawns a new process and they run without disturbing the other process in case of a failure. The sockets are efficient and as sources claim, Erlang VM can handle 2000 requests in a matter of microseconds. Phoenix also provides a front-end library that provides abstraction over raw web sockets.

PERFORMANCE

Elixir runs on top of very reputed technology known for its performance and concurrency. It has proved far more scalable than many of the existing languages and has known to provide very high throughouput comparatively.

CONCLUSION

Elixir is still in its early stages and evolving continuously, if you are looking for a language with high performance capability on concurrency, elixir might help you in a lot for your project. It is functional and might take a little time to understand the flow for those coming from OO paradigm, but the functional paradigm and immutability of the data structures add to its performance. So if you are looking for a language with high performance, do check elixir out.