Comment by kybishop

Comment by kybishop a day ago

49 replies

After programming with elixir and phoenix for a few years (with many prior years of rails experience) I have a hard time seeing why one would choose rails.

Elixir is more performant, has compiler safety guarantees that are only getting better as types are introduced, is actually designed from the ground up for web dev (being based on the Erlang VM), and... it's just way more fun (subjective I know). Elixir is what I always wished Ruby was, and I couldn't be more excited about the coming type inference.

Programming with Elixir makes me feel like Ruby is a previous generation language, much like Ruby made me feel that way about Cobol or Fortran, it really is that stark.

demosthanos a day ago

> is actually designed from the ground up for web dev (being based on the Erlang VM)

Nit: this makes it sounds like the BEAM was designed for web dev, which it was not. Erlang came out of Ericsson and was built for telecoms (OTP stands for Open Telecom Platform), which is where its unique set of trade-offs comes from. Many of those trade-offs make a ton of sense for web but that's not because it was designed for web, it's because there's overlap between the fields.

One way to see the difference between telecoms and web is to ask yourself when was the last time that you were working on a project with an availability SLA of 9 nines (1/3 of a second of downtime per year) or even 6 nines (32s per year). Some web dev has that, but most doesn't come close, and if that's not you then Erlang wasn't built for you (though you may still find you like it for other reasons!).

  • kybishop a day ago

    Very true it is actually designed for telecoms, but like you mentioned the distinction is so small it's not really even a stretch to say it is purpose built with at least the general architecture of web in mind.

    • demosthanos a day ago

      In the grand scheme of things, if we're considering everything from web to bridge building, yeah, the distinction is small. But within the world of software engineering specifically it's not all that small and it's worth being precise when we're talking about it.

      Whatsapp and telecoms have a lot in common, so no one questions that they benefited a ton from the BEAM.

      Airbnb, though? The main similarity is that they both send large quantities of signal over wires.

      Again, none of this is to stop you from liking the BEAM, but when we're talking about professional software engineering it pays to be explicit about what the design constraints were for the products that you're using so that you can make sure that your own design constraints are not in conflict with theirs.

      • throwawaymaths a day ago

        no. in the modern web world you often have persistent client server connections, which make it a distributed system out the gate. the most inefficient way to deal with this is to go stateless, and without smart architecture to deal with unreliable connection, it's really your best choice (and, it's fine).

        since BEAM gives you smart disconnection handling, web stuff built in elixir gives you the ability to build on client-server distributed without too much headache and with good defaults.

        but look, if you want a concrete example of why this sucks. how much do you hate it when you push changes to your PR on github and the CI checks on browser tab are still not updated with the new CI that has been triggered? you've got to refresh first.

        if they had built github in elixir instead of ruby would almost certainly have this sync isdur solved. in maybe two or three lines of code.

sanswork a day ago

I switched fully to elixir close to a decade ago now and library availability is still lagging. For pretty much any company I can be pretty sure there will be JS/Ruby/Python/C#/Java integrations/libraries and occasionally you'll find one for elixir maintained by someone that stopped responding to github issues 3 years ago.

It's definitely better but I can definitely see why you'd still choose rails these days.

  • kybishop a day ago

    I agree with this sentiment, though in practice it doesn't seem to be much of an issue the vast majority of the time. Sometimes you do need that niche library though, and end up forking and updating for your needs.

    Given how rarely this comes up it feels like a tolerable problem that will only diminish as Elixir adoption continues to increase; I am aware of many rail shops that are slowly and quietly switching everything to Elixir, and it feels like that snowball continues to pick up pace as Elixir improves and those libraries are created.

    • sanswork 14 hours ago

      It may come up rarely for you but for my workflow I hit into it at least once a month and if you're a new user you will hit into it more frequently as they initially port stuff over. I'm not sure what the solution is and it obviously hasn't been enough to keep me out of the ecosystem but it is something that is noticeably worse.

princevegeta89 a day ago

I have a very extensive experience with both Ruby on Rails and Elixir/Phoenix. Also ended up building large full-stack apps on either framework.

In the beginning when Ruby on Rails said hello to me, I instantly fell in love with it and the simplicity and the natural semantics that flow with it. It was absurdly easy to write new features and ship them to production. As the codebase grew and the team grew we started running into situations where APIs broke, or to trace the workflow of things in terms of finding where methods came from, finding parent modules of modules, and finding their parents, configuration, and I started to note a general lack of IDE autocomplete and type-safety.

Then after a few years I jumped ship to Elixir and if felt like a breath of clean air when I had to learn FP. Everything was simple enough to understand. Performance knocks Elixir, Node, Python and any other interpreted stack out of the water. The Phoenix framework was, and is said to be thoughtfully designed and although there was no IDE support, we still had Elixir LS which was great enough to provide realtime guidance, linting and type safety during compile time. I was able to ship a very large app into production and it was bulletproof. The problem with Elixir was our other engineers struggled to shift away from Node, or any other stacks they already knew. They found the entire FP world to be weird. Hell, I found it weird too at times. Simple mutations of maps and arrays, that would be trivial in Ruby ended up being so complex in Elixir. In the end it felt like my team was not on the same page. I guess Elixir would be great if you ran a 3-person team or something, but since we were not, we got back to Ruby. In today's world though, I am largely looking at Go, for a backend system. IDE support is up there with Java, and the ecosystem is old and mature enough to find any package that you look for. Performance is C-like and learning curve is lean.

Just my 2c with all these platforms.

  • LanceH a day ago

    I was working with Go a lot as something complementary to Ruby/Rails. I have ended up with so much Ruby work. Either maintenance of large successful efforts from years ago, new development for those same companies, or new development from the people who have experienced great success with Ruby on Rails. I can't seem to get away from it, and that's just fine.

    At this point, I putting together teams and getting new developers into Ruby on Rails. I'm also seeing companies move back to full stack RoR after the luster of React has worn off. Also, modern RoR can get you so far now with a fraction of the dual framework headaches of a RoR backend/JS frontend.

    • princevegeta89 21 hours ago

      Great to hear. I agree - all the react/SPA bloat along with other layers like Vite/SSR/Webpack etc. is not needed for 95% of the apps today.

      Any MVC framework with HTMX, JQuery (yes)/Hotwire/Stimulus/Turbo, etc. puts the productivity and deployment speed of the front-end setup above to extreme shame.

bhaak a day ago

Rails might be 90% better for webdev than the rest while Elixir might be 95% better. Talk about diminishing returns.

Add in problems finding developers skilled in Elixir and Phoenix and the small available libraries.

Of course, you also have that to some degree in Rails but it is much less pronounced.

  • kybishop a day ago

    > Add in problems finding developers skilled in Elixir and Phoenix and the small available libraries.

    Is this actually a problem you see? I'm going on 15 years in the industry and haven't seen any issues training people up on a new language in just a couple months.

    If you need an expert in some library or language to make meaningful business progress I feel like that says more about whatever tool or language you're using, and I simply don't see that with phoenix or elixir in the years I've worked with it.

    • Vegenoid a day ago

      I feel like the sentiment of “we can train a competent dev in our language and stack” has given way to “we want a dev with proven experience in our language/stack” over the last few years. I suspect this has something to do with more non-technical staff being put in between candidates and the engineers they’ll be working with during the hiring process. These non-technical staff rely on “x years of experience in thing” to know if a person might be competent at that thing.

      I think that this is one of the reasons networking is becoming more and more important, because it lets a candidate demonstrate their generally-applicable development skills to a fellow engineer who is capable of making qualitative engineering judgements.

      • strobe 21 hours ago

        yeah, and sometime it getting really ridicules: N years of experience in language doesn't count if no libraries from approved list was used.

    • lilsoso 21 hours ago

      > Is this actually a problem you see? I'm going on 15 years in the industry and haven't seen any issues training people up on a new language in just a couple months.

      Some years ago the largest company using Elixir in the US, or at least on the west coast, abandoned Elixir because they couldn't find enough developers.

      Yes. The adoption is poor despite the loud voices.

      • ricketycricket 13 hours ago

        That's so disappointing to hear. I have an intern who hadn't touched Elixir 4 weeks ago who is already making meaningful PRs. She's done the PragProg courses and leans a bit on Copilot/Claude, but she's proving how quickly one can get up to speed on the language and contribute. To hear that a major company couldn't bring resources up to speed, to me, shows a failure of the organization, not the language or ecosystem.

    • bhaak 18 hours ago

      The Ruby on Rails project I'm currently involved in doesn't struggle with training people, but rather with retaining them. There have been a few instances where we trained a junior developer and got them up to speed, only to lose them within a year. For small teams, this can be quite frustrating and disheartening.

      This issue might be partly due to the project being in a somewhat niche and conservative industry, so there are no startup vibes. However, since they started looking for someone ready to make a longer commitment than a developer who has just started their career, things have improved. But this approach also limits the pool of available developers.

      It's worth noting that we also use Elixir in this project (the chief architect is quite fanboyish about it), but we have never had any new developers come in with pre-existing knowledge of Elixir.

  • pdimitar a day ago

    > Add in problems finding developers skilled in Elixir and Phoenix and the small available libraries.

    Since the last 12-15 months, every Elixir job posted gets literal hundreds of applications. Just saying.

Shank a day ago

> I have a hard time seeing why one would choose rails

I like Ruby, and I feel it has significantly prettier syntax, to me, than Elixir. So that’s a big reason why I also like rails.

  • throwawaymaths a day ago

    It's a matter of taste, but i found Ruby syntax to be annoyingly inconsistent, and do |..| ... end being something that isn't quite a lambda a huge source of confusion.

    also activerecord doing "trust me bro" things behind the scenes (like pluralization) drove me up the wall.

    to be fair ecto does a small bit of this too, but at least it doesn't change spellings (so you can global search an identifier).

AstroBen a day ago

If you're looking for something to invest in for the long term I think Rails wins by a mile. They have the funding, investment and strong companies dependent on it to keep it marching forward - both the framework and surrounding libraries

bee_rider a day ago

Fortran nowadays is fairly ergonomic and modern.

In terms of successors there’s maybe Julia, or otherwise you’d have to use Python or Matlab/Octave, with all that going to a scripting language entails. In any case it doesn’t really feel like there’s been a replacement.

poisonta a day ago

Elixir is a great language, but it lacks a framework as polished and full-featured as Rails. Phoenix could have been far more popular if it had something like Active Record.

  • poisonta 10 hours ago

    Many Rails developers try Phoenix at some point because they may need better performance. They’re so accustomed to the Rails structure that they assume Rails has done everything right. However, Ecto and ActiveRecord are two very different beasts. When Rails developers try out Ecto, they often feel there’s too much boilerplate and believe the Rails design is much more intuitive. This, I think, is one reason Phoenix struggles to attract Rails developers. If it can’t please Rails users, it will rarely appeal to others.

  • burnt-resistor a day ago

    Ecto

    • pmontra 21 hours ago

      Ecto was literally the component I liked less in all the Phoenix stack when I worked with it after a dozen of years of Rails.

      I did maybe 5 years of Phoenix for a customer of mine and went back to Rails for another customer. It's good enough and overall Rails is easier to deploy IMHO. Capistrano vs I don't remember what.

      • kybishop 17 hours ago

        Oh man, this must just be subjective because I find Ecto to be beautiful compared to the absolute trainwreck of Activerecord. Having compile time guarantees through Ecto is wonderful.

        • pmontra 9 hours ago

          Yes, that must be the case because if my customers and I would care about compile time guarantees we would not be working with Ruby.

          In that years long Phoenix project one of the developers on the team added dialyzer type annotations to the functions in the files he worked on. Everybody else did not bother. The project ended up with no type checking. The service run and the company did well.

          Overall using Phoenix was a good experience. I never used Elixir in any other project and never for my own programs. I use several other languages for my own little scripts, mainly bash, Ruby, Python and Lua. I think that I really like dynamic typing.

guywithahat 21 hours ago

As someone who has used elixir for startups and loves it, the benefit of Rails for a startup is that it's easier to pick up. html/live projects can create more confusing layouts, which can make it harder to learn if you're trying to get something running. Rails is a great framework to use if you're primary product is not a website, but you need a website.

sergiotapia a day ago

Rails has more baked in for the typical crud app. Example:

Try to create a way for people to upload documents like images and PDFs and documents. Okay easy enough on both platforms and I want you to generate a preview for each of those files so that people can easily find those files. Now I want you to add pagination. Now I want you to add column sorting so that people can sort by file size or by name or by upload date. Finally I want you to add a search field. Going by the way all of this stuff needs to live in the URL so that you can bookmark all the different you know choices you've made.

The stuff is pretty trivial and rails but in elixir you would have to bake it all yourself very boring code that doesn't really matter. This is why I chose to build my startups admin dashboard in rails despite our main production API being an elixir.

  • ricketycricket 13 hours ago

    LiveView uploads are baked in, previews and all. Everything else you list is included in the Flop library, if you want something off the shelf. In rails you are still including Kaminari or whatever other gems for all this too, so this is really no different.

  • sanswork 14 hours ago

    Check out ash-hq.org they are basically building the data side framework to handle all those things and it works great with Phoenix.

    • sergiotapia 14 hours ago

      Extremely risky tbh I would have an extremely hard time if I go off path or need to hire someone. It would be almost negligence to choose it unfortunately

      • sanswork 14 hours ago

        It's the opposite since it standardises everything as oppose to roll your own.

        If you need to hire someone you'd need to train them on your system no matter what, with a framework you can use their documentation to explain where things are and how they work.

burnt-resistor a day ago

It'd be nice if IEx command history search and recall worked, but it doesn't. ):

tiffanyh a day ago

Benchmarks of Phoenix vs Rails.

https://www.techempower.com/benchmarks/#section=data-r23&f=z...

Ranging from 1.5-3.5x faster.

  • ksec a day ago

    https://www.techempower.com/benchmarks/#section=data-r23&l=z...

    I thought to include other implementation from Ruby and Elixir. Rails has always been doing much more and on the heavier side of things. There are also many test that simply by switching server to iodine brings the performance to Elixir / Phoenix level.

    • pdimitar a day ago

      These benchmarks will be forever amusing. I've done two full migrations of a Rails app to Phoenix and the differences we've seen in our telemetry boards ranged anywhere from 4.5x all the way to 20x.

      IMO TechEmpower lost all credibility long time ago after it was demonstrated they do nothing against heavily gamed benchmarks where people literally do basic string matching against regexes instead of doing proper HTTP parsing. Some even relied on characters being at exact positions.

      Add to this how slow they were to adopt normal production application code changes to Elixir apps where it was proven that the author of the benchmark had no idea how to code an Elixir/Phoenix app and yeah, it does not look good for TechEmpower.

      All that being said, use what you like (some even expressed the confusing stance of "I like Ruby's syntax more" which, need I even comment how unprofessional that is?). But to claim Elixir is just some mere 2x times faster than Ruby is misguided. My real production experience from the last 10 years says this is bull.

      • throw-the-towel a day ago

        What's unprofessional about liking one syntax more than another? Of course this shouldn't be the main reason to adopt a language, but having a preference is totally OK.

        • pdimitar a day ago

          Look in this sub-thread. One person claimed that is the main reason for them choosing Ruby over Elixir.

          I simply cannot respect that.

          Having a preference though? Yeah, absolutely fine. We all do.