DEV Community

Discussion on: Why should I not choose Ruby on Rails ?

Collapse
 
lpasqualis profile image
Lorenzo Pasqualis

RoR is great to get started. It allows you to make great progress quickly, and get a service up and running in no time. It can save you a ton of time and money. However, since you are asking "why not," here are a few major pains:

  1. Rails is upgraded with little regards for backward compatibility. Major changes can be made from version to version, and the upgrade cost can be significant. Sometimes it is almost a rewrite.
  2. You can scale applications written in Rails, but it is expensive. It is quick to get started, and it can scale somewhat easily to medium sizes, but at some point in your growth, you'll find yourself spending an amazing amount of time optimizing. The best way to approach the problem is to write very efficient code from day one, but it takes some considerable effort in RoR given that the language and the framework are pretty slow compared to other choices.
  3. Compared to other technologies, you'll need more machines to serve the same amount of traffic. Ruby is slow, and Rails is heavy, so you need a lot of hardware to scale.
  4. RoR code tends to be very "magic." Maintainability is not a great strength of the framework and the very weak typing of the language also makes the code increasingly difficult to maintain over time.

That said if I was starting a project I'd probably choose RoR. It gets you started and going quickly and you can worry about scale to the next level when you get there. At that time, there will probably be something new and better anyway.

Collapse
 
martyonthefly profile image
Sylvain Marty

Hi Lorenzo and thanks a lot for your reply !

When I posted this post on dev.to, this is the type of answer I have expected :)

I didn't know that Ruby and RoR were slow !

About your last sentence, I'm also reading about GoLang to see if it can be a good choice. I didn't find a good framework yet but it seems like the ecosystem contains a lot of modules that can be used to build backend services. Any idea about this language ?

Collapse
 
lpasqualis profile image
Lorenzo Pasqualis

GoLang is new(ish) compared to other languages. It was developed by Google and it is quite low-level. It is very fast, mostly because it is a compiled language that compiles to native code.

I don't have any direct experience with it, I only worked with it for small experiments. I am aware of the existence of a framework called revel, but I don't have any direct experience with it.

I also heard people say that you don't necessarily need a framework with Go, because it was created with modern Web development in mind. Here is an article on the topic.

If I had to start a project I'd choose Ruby on Rails if I want to get something running quickly. I'd choose GoLang or Java if I wanted something fast that can scale well.

That said, note that there are several very large websites built in RoR (including GitHub). So, it is possible to do it. It just takes some work a good design. Another example is dev.to itself, that is also built on RoR, and it is nice and fast.

Collapse
 
rossbates profile image
Ross Bates

Hi Sylvain - integration with external services and 3rd party APIs is something that's a strength of Ruby/Rails that's often overlooked when people are comparing web frameworks.

Browse rubygems.org to get a sense of the size and scope of the contributions made by the community. As your app grows and you look to connect with other services for authentication, storage, monitoring, etc... you'll find that someone has already written a gem for that service resulting in less code that you need to implement.

I won't lie, this can lead to dependency hell if you start adding others to the dev team. But in the long run you're still more productive than writing everything from scratch.

Collapse
 
dakull profile image
Posăceanu Marian

The best way to approach the problem is to write very efficient code from day one

or you could just start with JRuby from day one :-) i.e. have your cake and eat it too

Collapse
 
lpasqualis profile image
Lorenzo Pasqualis • Edited

Yes, starting with JRuby is a good strategy as it allows you to write parts in Java, if you need the speed. You give up compatibility with some gems, but if you start that way it should not be a huge deal. Regardless, it is still slower than other technologies and you have to deal with Rails, which is still heavy (but things are getting better overtime.)

Thread Thread
 
dakull profile image
Posăceanu Marian

you have to deal with Rails

Rails is quite modular [0], [1] - one can easily strip the heavy parts or replace ActiveRecord with Sequel; bonus: with concurrent-ruby [2] things get fast real quick.

[0] - modular Rails controller
[1] - modular Rails
[2] - ruby-concurrency gem

Thread Thread
 
lpasqualis profile image
Lorenzo Pasqualis

It is definitely improving. Version 5 is quite modular. It is a new(ish) thing and it has indeed changed the game quite a bit. Before version 5 it was just mostly a big fat thing :) It has been a slow progress, and I hope they don't screw it up. The unfortunate way they tend to deal with backward compatibility is still somewhat of a concern, but maybe they'll figure it out. If one is willing to always upgrade to every new version religiously, then things get easier. The major problem I have seen is when people stop keeping up.
Threading in Ruby is not real parallelism. Also, most gems out there are not thread-safe, which makes it difficult to work with threads in Ruby.
That said, I am far from being bashing Ruby on Rails. I have been coding in RoR for 10 years, and I like the framework. One just needs to be aware of the tradeoffs and cost at scale. I have been through that pain with versions 2, 3 and 4 and it wasn't fun :) Version 5 promises to do better, but I don't have much experience with it yet.

Collapse
 
tracypholmes profile image
Tracy Holmes • Edited

And #4 is currently what perplexes me! SOOO much magic. I'm in bootcamp right now, and the curriculum is fine. Actually on my first Rails project. However, my brain can't deal with the magic at times and it's slowing me down! I've had people tell me to look at GO (like many folks in here), but I really do want to understand Rails. Maybe I just need to walk away from it for a while...

Collapse
 
lpasqualis profile image
Lorenzo Pasqualis

They call the pattern "convention over configuration". You could name it "magic over logic", but that wouldn't sound too good :-)
The major issue I have found is that when something is magical, the way the magic works can change over time, and there is nothing that tells you. That is one of the reasons why upgrading to new versions of Rails is never too easy.

Thread Thread
 
tracypholmes profile image
Tracy Holmes

(had profile issues, but it's me!) Thanks! I actually like "magic over logic". It's a good band name - but also very true.

Thread Thread
 
lpasqualis profile image
Lorenzo Pasqualis

It is a good band name, isn't it? :) Also, it the domain name is not taken :)

$ whois magicoverlogic.com
No match for "MAGICOVERLOGIC.COM".
>>> Last update of whois database: 2017-09-12T22:06:14Z <<<
Thread Thread
 
lpasqualis profile image
Lorenzo Pasqualis

It didn't take very long :)

$ whois magicoverlogic.com
   Domain Name: MAGICOVERLOGIC.COM
   Registry Domain ID: 2162361165_DOMAIN_COM-VRSN
   Registrar WHOIS Server: whois.namecheap.com
   Registrar URL: http://www.namecheap.com
   Updated Date: 2017-09-12T22:15:12Z
   Creation Date: 2017-09-12T22:15:10Z
   Registry Expiry Date: 2018-09-12T22:15:10Z
   Registrar: NameCheap Inc.
   Registrar IANA ID: 1068
   Registrar Abuse Contact Email:
   Registrar Abuse Contact Phone:
   Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
   Name Server: DNS1.REGISTRAR-SERVERS.COM
   Name Server: DNS2.REGISTRAR-SERVERS.COM
   DNSSEC: unsigned
   URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
>>> Last update of whois database: 2017-09-12T23:36:14Z <<<
Thread Thread
 
tracypholmes profile image
Tracy Holmes

:kaff:

I wondered if you were going to see that! LOL. Just know it's in good hands! Thank you so much for the idea. I feel like we could make a twitter account for it that....oooh. Give me a sec. I feel a project coming on!

Thread Thread
 
lpasqualis profile image
Lorenzo Pasqualis

Haha, that's cool. When you bring up the side just consider adding a link to my blog somewhere. That's all I ask :-) ;-)

Thread Thread
 
tracypholmes profile image
Tracy Holmes

Will definitely do!

Thread Thread
 
lpasqualis profile image
Lorenzo Pasqualis

;-)