Follow

Do I know any Ruby people who have done work with Elixir as well? I'm curious to hear about how the languages and ecosystems compare, what do you like about one vs the other?

· · Web · 2 · 1 · 0

@gueorgui If I remember correctly @peregrine is working on Phoenix so maybe he knows some people?

@thomasorus @gueorgui everyone on Phoenix team came from ruby/rails. Author of Elixir was previously on rails core team. I would be happy to answer questions

@peregrine Nice! I guess my first question will be, as I became more experienced with Ruby/Rails, I started to use various OO design patterns to make my apps more modular and more loosely coupled, so I see OO as a strength of Ruby/Rails. Do those things translate over to Elixir/Phoenix? I have very little clue about functional programming, so I might be framing the question wrong, in which case I apologise.

@gueorgui in phoenix much of the route->controller->view->html stuff you are familiar with in rails comes over. And jumping straight into a phoenix generated project it will be clear where/how things are working.

The biggest conceptual leap will be learning to think functionally and working with immutability. Many of the patterns you used in OO will have functional equivalents but won't be named really.

In my experience the leap is short though and many become productive in a few days.

@gueorgui Ecto (ie ActiveRecord) is a very different beast. And will take some time but once you adjust you will see the beauty of the Repo/Changeset pattern it uses.

@gueorgui the experience you have with OO/coupling/encapsulation will be useful instincts when designing any system. It just often won't be necessary in a functional world.

(there is also the topic of OTP/Processes/Supervisors in Elixir/Beam etc that I'm ignoring because you don't need to explicitly know them to be extremely productive and when you need to learn them you will know)

@peregrine Thank you for the explanations! That makes a lot of sense, and after reading your replies I'm keen on playing around with Elixir/Phoenix :D

@gueorgui As a front-end developer, I've worked on projects using one or the other (Elixir/Phoenix, Ruby on Rails)

Elixir/Phoenix seemed nicer to work with because of more encapsulated view logic (not templates, which rails calls "views", but actual view modules). This type of logic typically ends up in the controller or the model in Rails projects, which quickly gets out of hand.

I enjoyed the terse functional style of Elixir, and pattern matching is a really powerful tool for control flow.

@gueorgui Rails is getting a new feature called "view component" in 6.1 which seems really awesome for creating/encapsulating reusable front-end components.

Phoenix has LiveView which seems like a game changer (I worked on a project using it and it blew my mind. You can essentially create a single-page application, but it's all server-rendered and much easier to test).

@stephen That's really cool! In your experience, how do people decide whether to build with Rails or with Phoenix? Is it dev experience/availability?

@gueorgui It's been a while since I've been involved in that stage of the process. I do more maintenance these days.

Personally I'd pick Phoenix for a personal project because functional makes a lot more sense to me than oo. Ruby is of course more established than Elixir.

An observation: the teams using Elixir I've worked with have all been fully remote. Only a few teams using Ruby I've worked with have been remote.

Sign in to participate in the conversation
Merveilles

Merveilles is a community project aimed at the establishment of new ways of speaking, seeing and organizing information — A culture that seeks augmentation through the arts of engineering and design. A warm welcome to any like-minded people who feel these ideals resonate with them.