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:

Where Next?

Popular in Discussions Top

PragTob
Hello everyone, I know we had quite some threads (read through lots of them) about background job processing but it remains a hotly deba...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 53578 245
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
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
MarioFlach
Hello, I want to share a project I’ve been working on for a while: Background Some time ago I came across a talk: How we scaled git l...
New
pillaiindu
I want to convert a Phoenix LiveView CRUD website to a CRUD mobile app. What do you think is the easiest way to do so?
New
crispinb
On reading dhh’s latest The One Person Framework it strikes me that Phoenix with LiveView is already pretty much this. However, never hav...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39247 209
New
IVR
Hi all, I’ve seen a number of related threads in the past, but I’d still be very curious to hear an up-to-date opinion on this topic. I...
New
New

Other popular topics Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
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 31107 143
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

We're in Beta

About us Mission Statement