stratacast
Elixir vs Ruby on Rails
I don’t really know how to frame this because I’ve never used Ruby, or Rails, or even looked much into them. I have been avidly working with Elixir these last couple months, and was exposed to it some time last year. So this question comes from complete ignorance of any of the Ruby world.
To my understanding, Elixir is to Ruby as Phoenix is to Ruby on Rails. Is this assessment correct?
The reason why I ask is because in my company there is an interest in Erlang/OTP but no interest in Elixir because Elixir == Rails. From my time in Elixir and my reading, that does not seem correct. However, I want to provide accurate information. When I look at comparisons, pages come up doing comparisons according to my original assessment. I don’t understand the disdain for RoR, but in the applications I’ve been working on, Elixir has been an incredible language and I want to show that Elixir is worthy of consideration (though there really wouldn’t be anything wrong per-se going with raw Erlang)..so in relation to all this, is there a reason why someone who would dislike RoR also dislike Elixir? Syntax aside, since apparently Elixir has a lot of Ruby syntax influence.
Most Liked
benwilson512
That is essentially correct, although Phoenix is a lot less of a monolithic framework than rails.
This is definitely wrong. Elixir is a programming language, not a web framework. It doesn’t contain a web framework at all.
I think it’s just the syntax. People see Elixir’s syntax, they see the Ruby influence, and they jump to the conclusion that Elixir “Rubified” Erlang. This is simply not true. Elixir is a function language with immutable data and 0 overhead with respect to the equivalent Erlang, equivalent code compiles to equivalent byte code.
hauleth
Well, actually there is httpd in OTP.
Rails is framework that is actually built from few libraries:
- ActiveSupport
- ActiveModel and ActiveRecord
- ActionView
- ActionPack
Other parts are helper modules for different aspects and do not really need to be included. In fact even ActiveModel and ActiveRecord aren’t really required parts.
So there is few tightly connected libraries that cannot live without each other (especially almost everything rely on ActiveSupport).
On the other hand Phoenix is just a helper library for Plug with few macros for simpler routing definitions and sockets handling, other than that there is really nothing “big” in it. Even the storage layer - Ecto - is completely independent, and while there are some people working on both, the projects aren’t related to each other in any way. For example most controllers in phoenix can be simplified to:
defmodule MyApp.Controllers.Foo do
@behaviour Plug
@impl true
def init(opts), do: opts
@impl true
def call(%Plug.Conn{params: params} = conn, _opts) do
action = Phoenix.Controller.action_name(conn)
apply(__MODULE__, action, [conn, params])
end
# …
end
Of course it is very simplified as there is few more things like setting default layout and view or calling Plugs defined within the controller, but very simple version of controller can look like that and for Phoenix there will be no difference, as there in reality is no more magic.
tristan
As someone who prefers Erlang to Elixir I can without a doubt say that their concerns are not valid. If they are interested in Erlang/OTP there is no reason not to consider Elixir, esp if they already have someone at the company who has been working with it.
From the outside looking in on both Rails and Phoenix I’ve seen there is concern about how Rails becomes essentially its own language to learn. Like a Ruby person can’t just jump into a Rails project and a Rails person can’t just jump into a Ruby project. I don’t know how true this is but I do know that it isn’t the case with Phoenix.
Sure, I think the Plug macro pipeline is confusing to read coming from Erlang but that’s about it – again very limited Phoenix exp and no Rails exp, so take this with a grain of salt.
That all said – Elixir/Phoenix is not like what happened with Ruby/Rails – definitely nothing wrong going with straight up Erlang :). Tooling and integration with Elixir projects has improved a lot. I saw someone mentioned Adopting Elixir so I’m obligated to mention Adopting Erlang booksite 







