stratacast

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

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

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.

14
Post #2
hauleth

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

tristan

Rebar3 Core Team

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 :slight_smile:

Last Post!

silverdr

silverdr

The only thing I’d add to this is that this kind of behaviour I’ve seen mostly from people who don’t actually know or understand the thing they use as a negative label - in this case Rails. Wouldn’t be much surprised if this was the case here too.

Where Next?

Popular in Discussions Top

AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31707 143
New
sergio
There’s a new TIOBE index report that came out that shows Elixir is still not in the top 50 used languages. It also goes on to call Elix...
New
rower687
Hi all, I’ve been reading a lot about the “let it crash” term and how supervising processes and the whole messaging passing make an elixi...
New
pillaiindu
In django there is a cache framework backed by memcached. Rails also puts a lot of emphasis on caching, and even the idea of russian-doll...
New
PragTob
Hey everyone, this has been brewing in my head some time and it came up again while reading Adopting Elixir. GenServers, supervisors et...
New
jer
I’ve been using umbrellas for a while, and generally started off (on greenfield projects at least) by isolating subapps based on clearly ...
New
slashdotdash
Phoenix Live View is now publicly available on GitHub. Here’s Chris McCord’s tweet announcing making it public.
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 42576 114
New

We're in Beta

About us Mission Statement