DEV Community

Cover image for Why should I not choose Ruby on Rails ?
Sylvain Marty
Sylvain Marty

Posted on

Why should I not choose Ruby on Rails ?

Hi everyone!

Over the past months, I have worked on backend specifications for a personal project. I must now choose the framework I’ll be using.

On the one hand, I’ve been working on a system built with Java Spring for the past 2 years, and I have been wondering if knowing a technology is a good enough reason to chose it over other languages and/or frameworks. Still, I know that Spring is stable, fast and adapted for big project and can save me a lot of time.

On the other hand, I know that some big companies use Ruby on Rails to build their services (like Gitlab, Airbnb, 37 Signals, etc.). From what I know, RoR seems to be a stable and strong framework.

I looked at some benchmarks between those two on the net (links at the bottom), but I find myself more lost than I was previously.

Here’s my question: Why should I not choose Ruby on Rails ?

Here are my project’s needs:

  • must deal with a big amount of data and entities

  • will connect with a GraphQL API (more than 70 endpoints)

  • public and private endpoints over HTTP and HTTPS

  • OAuth2 authentication provider

  • probably a few WebSocket endpoints too

For me, this framework choice is very important because it will help me decide what language I need to use to make internal and external services around the final product. For example, if in the future I need to make a program to control hardware or device like printers, I will use the same language I used to develop the backend in order to make maintenance easier.

I know my question isn't very specific so maybe a list of features I’m interested about will help:

  • maintenability: code quality, number of line of code

  • reusability: make the code more modular, generic

  • performances: HTTP(S) request (JSON or HTML responses), databases

  • templating: what engine can I use (what is the best ?)

  • unit testing, code coverage and Selenium test

  • scalability

  • continuous integration

Some benchmarks found on the web :

Credits :

  • cover image from perfectial.com
  • A great thanks to Thierno which helped me to review this article <3

Top comments (46)

Collapse
 
hrishio profile image
Hrishi Mittal

I’ve been working on a system built with Java Spring for the past 2 years

Stick to what you know. Use Java Spring.

I say this as someone who does not like to touch Java and uses Rails for a living.

The no.1 thing that will kill your project is not language/framework slowness, but messing around with tools instead of shipping software.

Collapse
 
martyonthefly profile image
Sylvain Marty

Hi Hrishi,

This is a side project that I work on my free time. So, I have the time to choose, try and learn the most adequate language for my project. :)

But yeah, you are right, if a project need to be shipped in a short time, I would rather use Java Spring to avoid messing around with tools !

Thanks for your reply !

Collapse
 
hrishio profile image
Hrishi Mittal

Ah I see. If you want to explore, then go wild! I'd say try Node as well as Rails.

Collapse
 
bgadrian profile image
Adrian B.G.

Basically you recommend the "when you have a hammer everything looks like a nail". Not a good approach for professionals.

Anyway Java can do web services, but shouldn't.

Collapse
 
lluismf profile image
Lluís Josep Martínez • Edited

Or maybe because both Spring and RoR are swiss knifes, not hammers. Both perfectly valid for the task.

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
 
soundstruck profile image
Dina Gathe

Have you had a look at Phoenix/Elixir? It checks off many of your boxes. When I was hunting for a framework I had criteria very similar to yours, and I ended up with Phoenix/Elixir.

Here are some interesting links to check out:

Phoenix/Elixir Overview
Pinterest re: Elixir gains
Bleacher Report 18 months in Production
Moz.com use

I've been developing side projects with Phoenix/Elixir (and Vue) for about a year now...happy to connect if you're interested in delving any further. My projects are smaller and don't yet have the scaling requirements, which is why I included those links above as those companies are using it at a much larger scale in production.

Collapse
 
kozlovski profile image
Stanislav Kozlovski

Unfortunately this requires a shift in programming paradigms, something that will severely slow most developers. The framework is new-ish as well and support (e.g stackoverflow answers) is still not up to par with RoR.
I'd argue it is not worth it unless the author really needs to scale his application.

Otherwise, I agree, Phoenix is an amazing framework!

Collapse
 
bgadrian profile image
Adrian B.G.

Quick answer, because Go is better.

It is just me or all your needs are met by Go? You do not need a framework, making backends is very easy.
Server intro example

It's low level so your future hardware control should be easy to add.
Scalability is one of the key factors of Go
Testing - it has builtin unit testing and benchmarks tools
Large amount of data & performance - see 1M requests per minute with 2 servers
Reusability - the languages enforces the usage of small packages.
Continuous integration - yes. It's light, you do not need a container, you will have only 1 binary file
templating - it has a builtin simple template system

You will learn it fast.

Collapse
 
martyonthefly profile image
Sylvain Marty

Hi Adrian,

Thanks for the sources, they are very helpful.

I am currently interested by Golang and the performance that it provides. To be honest, I love how so easily the language deals with stuff like routine, code coverage, cross-platform development, etc.

Nevertheless, I am a little worried about two things that slows me a lot to choose this language : dependency management and the project's files structure. I know that dep is in the good way but I am used to Maven and its stability, so
it frightened me a little. About the files structure, I don't want to mess with packages arborescence and I didn't find a good example of file structure on the web yet. :/

Thanks for your reply !

Collapse
 
bgadrian profile image
Adrian B.G.

Hi, the official dependency management is almost launched, see here.

The structure I find to be a plus, packages == your business logic == your structure. In Php/Ruby etc you have to obey a Frameworks structure, not your business one, which I think is a big flaw.
repo/user/project/
repo/user/library1/
repo/user/entities/entity1

Collapse
 
martyonthefly profile image
Sylvain Marty

In addition about the lack of dependency management, I would say that it frightened me because Go provide a large ecosystem that contains certainly all my needs (OAuth2 provider, GraphQL implementation, etc.). So, if my system have to be based on other's work, I really want to have a good and stable dependency management. :)

Collapse
 
aghost7 profile image
Jonathan Boudreau • Edited

From what I've read it seems that most large companies have more than one application component in their stack. For example twitter uses RoR for its frontend but the API is written in Java/Scala (using finagle framework IIRC).

To me it sounds like one of the major deciding factors will be the ability to process large amounts of data. The only two languages which I can think of that have a proven track record for this is Python and Java. I don't recommend going with something risky like Go or Elixir for a project that sounds fairly large.

Collapse
 
martyonthefly profile image
Sylvain Marty

Do you have sources that explain how they manage their stack of applications ? I would love to see how those companies deal with differents runtimes ! :)

And yeah, I know that Java can deal with a large amount of data but I don't want to be stucked in a language that I choose because I know it. ;)

Thanks for your reply !

Collapse
 
aghost7 profile image
Jonathan Boudreau

Their setup is pretty complex to say the least. IIRC they're using puppet, mesos, etc as part of their infrastructure.

If you're looking for how to manage this on your own project I recommend just learning a configuration management tool like ansible, saltstack, puppet or chef. I personally prefer ansible.

Thread Thread
 
martyonthefly profile image
Sylvain Marty

I didn't know the existance of that kind of tools! I will take a look, thank you. :)

Thread Thread
 
aghost7 profile image
Jonathan Boudreau

Its a bit like a script runner. For ansible its just a YAML configuration and setting it up is pretty simple. You just need ansible of installed on the machine you're executing your "scripts" (they're called playbooks in ansible world) from and ssh configured for all of the servers you want to automate.

Collapse
 
rhymes profile image
rhymes

If you want to delve in Ruby/Rails performance I would start here:

Scaling Ruby Apps to 1000 Requests per Minute - A Beginner's Guide
Is Ruby Too Slow For Web-Scale?

Obviously each app has its own requirements, traffic and consideration but one thing I've learned over the years in web development is that Donald Knuth's "premature optimization is the root of all evil" still holds ;-)

Start with what you know. Analyze each requirement and see if your platform of choice has all the tools and the libraries you need. Also consider if the app is going to be developed by you or a team of people and so on.

Finding people to help you with Java or Ruby is way easier than finding talent in Elixir.

As with most "is this better than that?" questions the answer is almost always: it depends.

Collapse
 
martyonthefly profile image
Sylvain Marty

Hi,

Thanks for the links, I will had them in my research ! I know that optimization is evil when we start to develop a project. But like others said in their replies, if the language and/or the framework are slow, optimization will be needed earlier than with other languages.

About the question "is this better than that?", it was the first title of this post. I thought that it wasn't the good question. Then I asked myself "Why do you want to compare Java Spring with Ruby on Rails?" and I knew that it would be a debate that I had already read on the internet ! ;) What I really wanted to know is the experience of others about this language : why they left it or why they chose it. I'm glad to see that the community bring me a lot of answers that I didn't find on the internet before. :)

Thanks for your reply !

Collapse
 
rhymes profile image
rhymes • Edited

No worries.

I think it's important is to find the balance between speed of development, time to market and available skills. If it takes you double the time to develop in Elixir instead of Spring and then you have a system that only you can work on, the "superior speed" might not matter.

That's my point, sorry if it wasn't clear earlier.

Collapse
 
tomerbendavid profile image
Tomer Ben David

I would go with RoR if Ruby was a statically typed language. As it's not I'm afraid that in most cases dynamically typed language can only be maintained (in really most cases) only by the developers who wrote the code.

Collapse
 
gregopet profile image
Gregor Petrin

Because Ruby is wacky? :) (sorry, personal distaste for Ruby :p)

But you could try Grails as a mix of both worlds: inspired by Ruby on Rails, powered by Spring Boot, in active development since 2005, uses Groovy as its language (Groovy is like injecting Ruby mojo into Java).

I've completed several projects with Grails and while I'm increasingly using micro-frameworks lately for web, Grails is still a very fine framework.

Collapse
 
martyonthefly profile image
Sylvain Marty

Hi Gregor,

I will take a look on Grails to see how it works ! I already tried the Kotlin implementation for Spring and it was very cool to use :) Nevertheless, I don't know if Grails is similar to Kotlin...

Thanks for your reply !

Collapse
 
gregopet profile image
Gregor Petrin

Grails is a framework while Kotlin is a language so you can't directly compare them.

You can compare Grails vs. Spring Boot (regardless of the language in use, and you have quite a few to choose from) in which case Grails is a more opinionated, convention-over-configuration framework with lots of helpers, integrations and concepts that would be left for you to implement on your own in Spring Boot. It has, for instance, its own persistence framework, based on Hibernate down below but looking a lot more like Rails' active record to the programmer. There's plenty more: centralized URL mappings, command objects, a service layer, HTML helper tags and JSON & HAL renderers come to mind first, but do take a look at the docs yourself (and the docs are pretty good btw, which is a huge bonus).

As for the languages, Groovy and Kotlin are loosely related; Kotlin actually took a few of its concepts from Groovy (as did Swift). Groovy is a bit wilder, optionally typed, script-like language, comparable to Ruby. Crazy productive! .. though sometimes its wild side is a bit too much. Kotlin on the other hand is strongly typed, with extra strictness added on top (e.g. null safety and immutable variables). Personally I prefer to use Groovy for scripting and the view layer, and Kotlin for the business logic.

Theoretically, you could use Kotlin to write Grails code, but it's probably not optimal because a lot of the Grails magic relies on Groovy's concepts.

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
 
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.

 
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!