Hacker News new | ask | show | jobs
by zen_boy 4796 days ago
Are there any beginner friendly articles about Elixir?

I've been mainly doing web programming with Ruby and want to understand how Elixir is useful and why I would choose it over something else.

2 comments

The big reason to use something like Elixir, Erlang, or of course Node.js or other things of that ilk is if you're using a lot of web sockets, streaming, or that kind of thing. With Rails, a connection that stays open is (unless they've changed it recently) going to hog a whole Rails process, which is a lot of resources to tie up.

A secondary reason might be if you're doing pretty much everything in Javascript on the front end, a lighter server process is probably going to work out better in terms of resource usage. Myself, I'd probably still opt for Rails while developing, just because it's so fast to get something up and running with, and you're going to need to do stuff like authentication server side anyway.

If you want something that's vaguely familiar, you might have a look at Chicago Boss. It doesn't do as much as Rails, but it's fairly easy to get up and running, and the guy who built it is very friendly and helpful: http://www.chicagoboss.org/

How does Elixir/Erlang compare to Go?
It doesn't.

Big runtime, VM, no mutable state (really), no direct access to memory, pattern matching, exceptions, no side effects other than sending messages, no destructive assignment, single assignment variables - that's an incomplete and subjective list of Erlang features. How much of it is even comparable to what Go offers?

> It doesn't.

Sure it does: they're both programming languages that people use to get stuff done.

Erlang is far more robust than Go at this point in time, from what I can see, and much more mature - its history goes back some 20+ years. It has a bunch of stuff for distributed, concurrent, fault-tolerant computing that is, in some ways, the best in the business. However, it also brings with it an accretion of warts that it has brought with it over the years, starting with a syntax that most people do not find easy. Go is very new, still being worked on, and, as klibertp says, is quite a different beast in many ways.

My thinking is along these lines: if you want something rock solid, use Erlang. If you want something that's "pretty good", and getting better, Go might work out well for you.

The getting started (http://elixir-lang.org/getting_started/1.html) guide is pretty good I think and will take you quite a ways in. Elixir does not yet have the mature frameworks and libraries to compete with Ruby for developing web applications though it could be a pretty good choice for developing APIs. Today the main advantage is if you want the functionality of Erlang/OTP with more powerful support for meta-programming to cut down on boilerplate and polymorphism.