7
33 Comments

Tough choice between rails and laravel

Hi hope you can help, im wanting to learn a framework i have experience in javascript but wanting to learn another language and backend framework im really struggling to take the leap and get into either laravel or rails,

Im going to stick with one and try and get really good with the framework and language I choose. Can anyone here let me know any pros and cons for the frameworks with regards to learning curve, extensions, flexibility etc

Thanks

on December 16, 2020
  1. 4

    (Rails developer here)

    Laravel and Rails will provide similar functionalities, support and ecosystem in the end.

    I recommend you actually make a choice between PHP and Ruby. Look at a few tutorials, blogs and popular libraries for both languages. Try them out locally. Then pick the language you enjoy the most.

  2. 4

    Unless you already know PHP, I'd definitely suggest Rails. The ecosystem of gems (aka extensions) is very large and it's extremely flexible. Always my go-to for building something quick and custom.

    The learning curve is going to be similar with both if you have no previous experience with PHP/Ruby.

    1. 2

      Actually as a big fan of Ruby and Rails, I'd say the biggest benefit to someon who has to learn a different language is how easy Ruby is to read and understand.

      Rails is great too, but I don't doubt that Laravel is pretty close or even better. But I'd take Ruby over PHP any day.

    2. 1

      Thanks i will check out rails!

  3. 4

    They're both great. I gotta say though — I'm a big fan of Rails. I'm self-taught and it took me a few months to get to the point where I could build a full-featured app in Rails. There's also some new functionality coming out in Rails (code name "NEW MAGIC") that sounds really exciting. Plus ruby 3.0 is almost out. There's a lot of cool things and movement on everything ruby and rails lately.

    If you do decide to check out rails, there's also some handy tools like jumpstart pro to help you build an app rather quickly.

    1. 1

      Thanks for the reply, where would you say is the best place to learn rails? I've been looking but not really found a lot which I find surprising for such a framework with a big community, thanks

  4. 2

    I am using Laravel and the learning curve is not that difficult. The documentation is pretty good and there are lot of videos if you want to learn. I did try rails few years ago and when I compare the effort needed, I would say go with Laravel.

  5. 2

    I'd skip both as there's not a significant difference between them. They're both MVC frameworks that run on object oriented languages and all the baggage that comes with that.

    Instead, I suggest Phoenix (Elixir). It's a different paradigm (function programming) and can handle concurrent and distributed tasks in a way that Rails, Laravel or even Node can't.

    Two sources I like:

    1. 2

      Meh, if he has no experience with functional languages, this will dramatically increase the learning curve. One really shouldn't choose FP languages just for the hype, because they really don't as much as one might think.
      Regardless of that, Elixir is still a delightful language to work in, with very good performance.

      1. 1

        Meh, if he has no experience with functional languages

        He said he knows JavaScript, which has had first class functions since the very beginning and a community that has strongly embraced a function style since 2014 or so. The hardest thing I've seen for Elixir newbies coming from JavaScript is that everything is immutable (like using constinstead of var or let in JS). If you can work with Immutable.js, you can work with Elixir.

        1. 1

          Eh, regardless, JavaScript isn't a functional language and there's still going to be a learning curve, that might not be present with a language, whose paradigm they're used to.
          There's really nothing wrong with OOP languages and if it means that OP might get something off the ground earlier, it might be more worth it. Pick the tech thats suitable for your problem at hand, not due to gimmics and hype, etc.

          But again, if they wanted to venture into FP and accept the added learning curve, Elixir would be a great choice. I've personally enjoyed it a lot, since I've started learning it.

          1. 1

            JS absolutely is a functional language. Functions are first class objects, there are closures, there are higher order functions, it has currying (which Elixir doesn't!), it has tail call optimization... the list goes on.

            It's not a pure functional language, but neither are Scala, Ocaml, F# or any of the modern MLs that are widely classified as "functional".

            Here's another thing that might surprise you: Alan Kay, the person who created Smalltalk, the original OO language, considers Erlang/Elixir to be a prime example of an object oriented language.

            Languages are increasingly multi-paradigm, boundaries of what language fits what paradigm are fuzzy and even the definitions have shifted over the years. There's an incredible amount of tribalism and marketing going into these kinds of discussions and I think it does you a disservice to growth as a programmer to be thinking in terms of "X is a FP language".

            It's much better to think in terms of "X has features A, B and C".

            1. 1

              Yes, I agree, JS has functional paradigm features. But is not a purely functional language, like you mentioned yourself.

              1. 1

                Yeah, both have higher-order functions. JS has currying but is aggressively multi-paradigm. Elixir is immutable and had macros but can't do currying.

      2. 1

        Exactly my thoughts. FP might be great, but learning it alongside everything else that goes into modern web MVC frameworks? No way. I doubt even Elixir enthusiasts like @alchemist would suggest Elixir and Phoenix for your first MVC frameworks.

        1. 1

          I nearly did. I worked almost exclusively with JavaScript from early 2012 to the end of 2015, then got really into Rails for a month before jumping over to Elixir. A lot of the stuff I learned for Rails (Active Record, Asset Pipeline, etc), I wouldn't have needed if I'd just gone straight to Elixir + Phoenix.

          One thing worth pointing out is that Phoenix is much smaller and simpler than Rails or Laravel. That makes apps easier to understand. There's no "magic" and there's almost never a need to worry about application state. It's just functions.

          The plus side for Ruby is that it's the nicest language I've ever used for Unix scripting and exploratory text manipulation. It's very terse, very readable, there's no need to start up a VM and you can just drop system commands into your file by throwing them in between backticks. You can do string interpolation in those backticks, too.

          tldr; Elixir is one of the easiest languages to learn and it can do things other languages can't. However, Ruby is still the most productive language ever for smaller projects.

    2. 1

      Hey, thanks for the shout out! Elixir definitely is a great choice for someone picking up a 2nd language after JavaScript and I think he'd find a lot of the same patterns work if he's already been using anonymous functions and higher order functions like map or reduce.

      The great thing about Phoenix is that you don't have to learn any of the harder parts, like macros or how OTP works but you still get the benefits due to the framework.

  6. 1

    Rails is far and away your best choice, and despite what the sockpuppet accounts who show up to recommend Phoenix or Laravel on every similar posts would contend, there’s nothing “old news” about it. How do you find out if someone programs in Elixir? Don’t worry, they’ll tell you about it.

    Rails has been insanely popular as long as it has because it is incredibly productive and has a massive ecosystem of high quality tools.

    Laravel has a diagram on their homepage showing all of these packages that ship with Laravel; every one of them Rails invented or had years earlier, in several cases before Laravel existed. You can see for yourself by taking a quick scroll through https://ruby-toolbox.com

    What speaks to me the loudest, however, is summed up at length in https://rubyonrails.org/doctrine/

    One of the most exciting things happening in the Rails ecosystem is the rise of StimulusReflex, a library that makes it easy to build reactive applications that keep state management on the server using websockets to deliver updates. Not only does the tech deliver, but the Discord server has become a gathering place for folks to ask questions without being shamed. Highly recommended.

    1. 2

      Discord is a great example of a young startup with great infrastructure built on Elixir that is already worth billions of dollars and StimulusReflex is a good imitation inspired by Phoenix LiveView 😄

      despite what the sockpuppet accounts who show up to recommend Phoenix or Laravel on every similar posts would contend

      Seriously though, I think you may be a bit too angry at Elixir users. Given my business and the fact that I reach out to them for interviews, I've probably spoken with actual people you thought were sock puppets here at some point. Some of them might even learn from my tutorials.

      I've seen dozens of these threads and if you search IH you'll see me recommending Rails many times in many different contexts. In fact, even when @coreyhaines was looking to learn any language, rather than the traditional IH answer of "buy my stuff", I suggested Ruby.

      A lot of devs are polyglots, and there's a huge overlap of Ruby and Elixir devs. This is especially true with things like Phoenix, which was inspired by Rails or StimulusReflex, which was inspired by Phoenix LiveView. Heck the creator of Elixir and half the core team came from a background of deep open source contributions in the Ruby world. I really don't see the animosity you do.

      I can't speak for every other commenter here, but at least in my case I'm genuinely trying to help people out in these thread. I remember being a non-dev who wanted to learn.

      1. 2

        That's all really fair. I don't want to make enemies with you or other (real) folks. :)

        Just as an FYI, StimulusReflex predates LiveView by four days. CableReady, SR's primary dependency which uses morphdom to actually push the updates, predates LiveView by 17 months. We were definitely inspired by Chris McCord's vision and presentations, but the gears have been in motion for a long time. It's a frequent urban myth that SR is a LV clone for Rails.

        1. 1

          Just as an FYI, StimulusReflex predates LiveView by four days.

          Fair enough! I've read in several places that the idea propagation went from LiveView to (Laravel) LiveWire to the Rails world, but it's much more complicated than that and it's clearly been involving a lot of convergent evolution towards an objective local maxima.

          It sounds like you're working on SR, so I want to say well done! I have recommended it on IH before and am a fan of the model.

          1. 1

            Right on.

            And truth be told: we only consciously realized the timestamp / repo creation date thing ourselves a month or two ago... but there's a clear timeline:

            CableReady: 1st README commit + tagged release May 19, 2017
            StimulusReflex: 1st README commit + tagged release Oct 14, 2018
            LiveView: 1st README commit Oct 18, 2018, first tagged release Aug 25, 2019
            LiveWire: 1st README commit Feb 28, 2019, first tagged release Apr 15, 2019

            Like many projects that grow to become successful, in the early days the project founder was just building what he wanted to use and didn't anticipate that someday soon there'd be 45,000 people a month downloading it.

            1. 1

              I see articles written about LiveView in September of 2018:

              That's because Chris McCord introduced LiveView at the Elixir Conf keynote on September 7th:

              https://www.youtube.com/watch?v=Z2DU0qLfPIY

              IIRC, he originally had the code in a repo on his personal account and later migrated the project to the one on the phoenixframework account.

              His Phoenix LiveView examples repo goes back to August

              I just tried Googling, and I can't find any trace or mention of StimulusReflex in August or September of 2018, though. Unless there is something substantial, I don't think I'd push too hard on the claim of being first.

              1. 1

                Both of those are just reactions to announcements.

                Nate choose to ship something people could use before promoting it.

                I don’t doubt for a moment that Chris was working on LV for a long time before it was available - as was Nate - but that’s not how we measure things.

    2. 1

      i was sure to go with laravel.... but that is such a compelling statement.. not sure what to do now

      1. 1

        If you're up for it, drop by the StimulusReflex Discord and say hi. Talk to a few folks and see what advice they might have for you. I think it's telling that even some Python/Django devs have started to hang out there, because it's so welcoming.

        https://discord.gg/XveN625

  7. 1

    (No experience with rails so I'm probably biased)

    As someone who does a lot of Laravel, I'd suggest you to learn Laravel. It is pretty easy to get started with and has all the flexibility you may need in the future. And the ecosystem is amazing.

  8. 1

    Another thing to consider is the overall popularity of both the frameworks and the language you'll be working in. I'll toss in 2 more for consideration since they are tied to more popular programming languages, Django / Python and Spring / Java.

    A few interesting trends:

    Stack Overflow:

    Google Search Trends:
    #1 - Laravel growing
    #2 - Django mostly flat
    #3 - Rails declining
    (can't really do "Spring" on google trends)
    https://trends.google.com/trends/explore?date=today 5-y&q=%2Fm%2F06y_qx,%2Fm%2F0505cl,%2Fm%2F0jwy148

    Programming Languages:
    Java (#2 declining) and Python (#3) dominate here over PHP (#8) and Ruby (#15 declining)
    https://www.tiobe.com/tiobe-index/

  9. 1

    This comment was deleted 4 years ago