CTO at wemake.services, organizer of elixir-lang.moscow conference.
On the eve of RailsClub 2017, on which Nikita will be one of the speaks, we questioned him about his way to Elixir and it's strong and weak sides.
Tell me about yourself, what are you doing, who are you?
What did you like? What is better in comparison with Python?
I liked it in addition to Python. Python has a certain limitations, for example, GIL, bad asynchrony, and so on. From the standpoint of asynchronous programming, Elixir is a dream. Also I really liked such features as pattern matching and pipes. Now I try to use it in all languages where it is possible. This changed the way I see the perfect code. The development went very quickly, taking into account the fact that we did not know this language at all. Elixir looks like a Ruby, although I do not know Ruby at all =) The only problem is OTP and what is connected with Erlang.
Why you didn't choose Go?
I just don't like Go at all. I don't like it's package manager, I do not like his niche. It seems to be low-level language, but not quite. A very strange piece of art, in my opinion. We didn't even consider it. But I know that now a lot of developers are coding on Go. And many of the Python coders are switching to Go because of performance gains.
What are the main advantages of the Elixir you would single out?
Stability of work. We have an example: there was a tracker for one large logistic company developed on the PHP. It constantly used an unlimited number of resources with regular drops and falls. Everything broke constantly. We were engaged in supporting this service for all day long. Then I've rewritted it to the Elixir and that's it. It already works without problems for 9 months, consumes fewer resources.
Often, when migrating to another programming language, another paradigm, for example, to functional, developer may face problems due to the different approach. When you had migrated to Elixir, it happened?
There are a lot of such problems. They are related to the fact that you can not mutate anything and you can not store the state. Sometimes you need to save some state and then apply to it. I always want to mutate something or perform a monkey patching. In Elixir, this can not be done and this is solved only in 1 way - with processes. Save the state, create new process and put the state there. For a mutation, send a message to the process and it will change it but not by a mutation, but via creating new copy of data. Everything is constantly work on the processes in Elixir. This is a very simple and understandable concept. If you stop treating processes as operating system processes, and understand it like a small, lightweight process that can have its internal states and it can communicate with others processes - it is very similar to objects in OOP. Creating an object is like creating a process in Elixir - it's very similar.
What are the disadvantages of the Elixir?
- In the first year of work with the Elixir it did not have any libraries. We wrote everything ourselves. Such as recaptcha, authorization, Russian names decline library and so on.
- The number of developers. It is very hard to hire somebody; to find a skilled coder. There are no elixirists at all. There are erlangists but they do not really like Elixir. They love Erlang and love to write on it. But many rubists are interested in Elixir and they migrate to it. It is really cool, but in the same time they will have to learn: 3-5 months (depends on other technologies master level) they will have to learn a lot and code slowly.
There are some technical issues, for example, memory starts to leak if configuration is wrong, or the process will fall due to the wrong architecture. If the process receives too many messages, its "inbox" is full and it dies. There is a good book "Erlang in Anger", it tells about these and other problems.
Erlang is quite old technology, older than Python and Java. Until recently, it remained a niche. Everything changed when Elixir appeared. Why no ErlangVM based programming languages appeared that could make this technology more popular?
This is due to the way how the world of web development is changing now: everything is realtime, big amount of interactions, all services are connected to each other. When you have an isolated synchronous service with no interactions with others - you just don't need it. An opportunity to communicate with other services appeared, to do big amount of things in the same time, asynchronously, and even ability to use in it the microservices appeared. We hadn't rewritten everything on Erlang and Elixir, we've just wrote a small piece of Elixir code and left other code on other languages (as we did with tracker). In these conditions Elixir has become a very suitable technology
How did you end up at a conference for the Ruby developers?
Matter of chance. I just saw the website of the conference and wrote to the organizers. I was asked to make a report. I thought it was a great idea.
What will your report be about?
About the Elixir. Why the Elixir is not a Ruby but better.
Why should an average Ruby coder come to your report?
You can see new horizons. When you listen to the report on a new Ruby gem, you can deepen your knowledge in a particular technology. And if you go to the report on Elixir, you can then expand your knowledge, find out what you can do in general in a different way. Such things help you grow as a developer.