Discovering Ruby on Rails: is it dead or alive?

Discovering Ruby on Rails: is it dead or alive?

·

7 min read

Featured on Hashnode

It's alive BUT

There are huge codebases of RoR from famous companies such as Github, Gitlab, Airbnb, Shopify, Groupon and even Twitch that are still using it. However the ecosystem is definitely in decline and companies are struggling to recruit senior developers.

image.png

Overall taking the approach of saying "tech X is dead" has never worked - and be cautious of whoever tells you otherwise. In the web dev world we have been hearing about how PHP has been dead for a while yet there are still millions of jobs and the ecosystem keeps evolving with amazing frameworks like Laravel. There are still jobs for COBOL devs FFS, so no, Ruby on Rails isn't dead but it's harder to get in as a beginner compared to other frameworks and languages although I consider it a great starting full stack framework, let me elaborate.

It's a pain to start (on Windows)

image.png As a developer you should be using Linux, of course, but I'm on my Windows machine right now and it has been an absolute hellish experience, so as DX goes RoR takes a big L from the start if you are a Windows user.

Let me help you a bit with the installation.

How to install Ruby on Rails on Windows

There are guides out there but the best resource to not run into any compatibility or dependency issues is just to follow this 27 minutes video from FreeCodeCamp and you should be good to go. No, it's not a joke.

Alternatively you can use WSL2 with Docker. Good luck!

How to switch between Ruby on Rails versions on Windows

If you happily installed the latest version of ruby and have decided to fork a project that uses an older version, well, it's not compatible so tough luck. Luckily you can use a 12 years old no longer maintained project called PIK to switch Ruby versions. Again, not a joke.

This article has been very helpful and it guides you through the whole process. Overall Onghu's blog seems very helpful if you are a Ruby developer.

Good for beginners

A fairly famous site to get into Web Development called The Odin Project teaches Ruby on Rails to beginners, while it might seem overwhelming at first I believe RoR will teach anyone good foundations to understand how a full stack application works, let's see why.

Funnily enough even The Odin Project doesn't have a guide on how to install RoR on Windows.

MVC

Ruby on Rails allows you to develop a modular monolith following the MVC pattern. It's a heavily opinionated framework that will make you understand MVC and stick to it, you want it or not, enforcing the good practices - something that's excellent for a beginner.

image.png image source

You will understand how everything is interconnected inside your application: anything data related is handled by your Model, the controller is there to apply business logic to the data you extract through the Model and the View is there to display and get the data from the user.

I feel as if I started as a developer with RoR I'd have an easier time understanding how a full stack application works (or software in general).

Double edged sword of abstraction

image.png As someone who just saw a glimpse of RoR, I feel like the framework can abstract too much away or have too many layers if you just want to jump in and start working. This means that you need to read and study a bit before getting your hands dirty in code. For me this is another negative point when it comes to developer experience.

I don't mean that RoR is bad but it is harder to get started than a lot of other frameworks which is something that might discourage developers from learning it, at the end of the day you want to build your project for fun, not read outdated docs and posts just to get started.
Which is another issue: you have a lot of posts and answers on SO that are fairly old and while they might be helpful it's confusing for newer devs as things have changed since then.

I believe it's not easy to start but once you put enough time you will get excellent results as the abstraction and all the built in features allow you to make a CRUD app blazingly fast.
You won't have microservices but instead you will have a solid modular monolith, which I'd say in a lot of cases is far better.

Get weird with Ruby

image.png After using Ruby for a bit the adjective that comes to my mind is fun. Depending who you are or how you work it might be the best or the worst thing ever. Here's a Stackoverflow post asking for a difference between && vs and to illustrate my point.

image.png Image source

Ruby is a language that allows you to write code however you want, there are various ways of doing the same thing which might sound wonderful BUT if you are working in a team your beautiful one-liner or the way you did something might confuse your less experienced co-workers.

Overall I think Ruby is amazing and it seems to allow a lot of freedom but there's a cost to having so many choices: your team needs to follow and enforce a particular code style.
If you want to dig a bit deeper then check this article about closures in Ruby.

RoR gets magically fast

Once you learn a bit of the framework you can make a full CRUD app in a few hours thanks to the generate command which allows you to make all the files you'd need for your CRUD operations, including routes and testing.
Here's an article that dives a bit in scaffolding with the generate command and keep in mind all these files will be created inside an already well structured project so all you have to do is write a bit of logic and you are good to go.

Additionally you have partials and concerns, to sum it up very poorly (the links explain it much better):

  • partials: view components that you can move around
  • concerns: mixins that allows you dependency injection

If you are unfamiliar with the terms mixin or DI, this article explains concerns a bit more in detail.
I like that the second paragraph is as follows:
"The Rails API documentation doesn't help, either. It starts with the assumption that the reader is already familiar with the problem concerns are trying to solve, and goes on to provide the solution, only adding to the confusion"

It really illustrates the struggles of someone who is new to the ecosystem and one of the biggest negative points about RoR right now.

Pros and Cons

Ruby on Rails is great if

  • You are a beginner and want to learn fundamentals of a full stack app
  • You want to make a fast CRUD app with a bit of time investment beforehand
  • You are a senior software engineer who wants to transition into a new ecosystem

Ruby on Rails is bad if

  • You have services where performance is extremely important

Let me quote a post from Gtilab: "while Rails is excellent technology for our purposes, it does have a few drawbacks, one of them being performance. Luckily, only a tiny part of most codebases is actually performance critical. We use our own gitaly daemon written in Go to handle actual git operations, and PostgreSQL for non-repository persistence".

However the biggest con of Ruby on Rails is its lack of support in terms of documentation, up to date tutorials and overall DX.
If the RoR community doesn't put more effort into its ecosystem and training junior developers or anyone coming from other frameworks it will suffer a slow and agonizing death where top companies will fight for a small portion of talent and others will try to rewrite their codebase by any means necessary due to lack of RoR developers.

Fin

If you have enjoyed this article or you want to scream at me because I'm wrong feel free to leave a comment, subscribe for more or hit me up on Twitter @tekbog.

PS: if you want to learn Ruby on Rails and don't know where to start then head to their page and click on Getting Started.