June 20, 2022
Every year, we’re pelted by articles proclaiming the death of this gem of a framework. And while Ruby on Rails (RoR) is a bit over 15 years old, it’s nowhere close to passing on from the world of programming.
Why use Ruby on Rails, you're wondering? In fact, there are many use cases where RoR offers a better fit than any other tool.
Ruby on Rails is an open-source server-side web application framework with an MIT license. While Ruby on Rails is written in Ruby, a dynamic, general-purpose programming language from Japan; RoR is in fact a framework, not a language. Many entrepreneurs and non-developers often confuse the two, thinking Rails when hearing Ruby but rarely the other way around.
This may be brought on by the fact that the majority of Ruby developers use the Ruby on Rails framework for development.
Ruby really only gained momentum as a programming language following the launch of Ruby on Rails.
Rails was created in 2004 and won the "Programming Language of the Year” award from Tiobe in 2006; despite being written in 1995 (a great year for action movies—Goldeneye anyone?).
There are other frameworks based on Ruby, but their popularity with developers and active contributors is low compared to Ruby on Rails. We’ll take a closer look at that later on in the article.
This isn’t to say that other Ruby frameworks are lower in quality than Rails. Quite the opposite, actually—they were built to respond to very specific use cases, and often outperform Rails in these instances.
Rails, however, will be a good fit for the majority of projects that call for using a Ruby framework.
Having delivered over 30 RoR projects since 2010, we know Rails inside and out. Take a look at one of our Ruby projects.
When RoR entered the scene in 2005, it introduced a fresh approach to building Web applications.
One of the things Rails brought along was the convention-over-configuration software design paradigm that facilitates developer work on many levels—for example, by eliminating the need to write boilerplate code.
Together with Django, Python’s most popular Web framework released the same year, Rails propagated the use of the MVC pattern and good development practices, such as the DRY principle.
The Rails way of Web development unshackled devs from the tedious parts of the coding, freeing them up to focus on the business features and logic of the app.
It also increased productivity and helped developers deliver MVPs and startup apps much faster.
Almost an urban legend by now, the myth of RoR’s demise is the product of many misconceptions that grew around the framework and the language it’s based on.
Time to dissect them, then.
While Rails has slower runtime speeds than, for example, Node.js or Golang, this only becomes noticeable with huge products with large-scale traffic.
And if this isn’t a huge app with a lot of users and requests, Rails isn't necessarily the culprit behind the slow speeds—there’s also server architecture or databases to consider.
With a well-thought-out architecture and infrastructure (a necessity in all large-scale projects, regardless of the programming language), even huge apps, or their parts, written in Rails can be fast.
Examples of large-scale RoR apps include Basecamp, Airbnb, or GitHub.
So where does all that bad rep come from?
Because Rails does so much for the developer, inexperienced devs tend to make wrong decisions when writing the code. With bad code, the drop in performance is significant.
When it comes to Ruby and RoR’s inherent performance issues, they are actively being worked on. For example:
I’ll start by explaining that it’s wrong to blame only the framework for scalability issues and deficiencies in handling many user requests.
For the application to serve requests quickly, each element in the server system architecture, not only the Web app’s backend, should be configured correctly and be appropriately performant.
Ruby on Rails was accused of being difficult to scale when Twitter moved away from Rails to Scala. The transition was probably what first sparked the debate around RoR’s scalability issues.
Still, let’s keep in mind that we’re talking Twitter-sized traffic here.
So, before condemning Rails, try to identify which element exactly is responsible for the slowdown.
Available scaling options with Rails:
Whenever a new framework emerges, especially one that brings something innovative to the table, it goes viral and suddenly hundreds of its users and contributors pop up all over the world.
Then a few years pass, the hype dies down, and what was once cutting-edge becomes much less exciting, intriguing, and challenging.
It’s maturing. But maturity does not necessarily have to be boring.
Maturity means stable, refined code; and maintainable Web applications, even if no longer written in a trendy framework.
Chasing technology trends isn’t always a good idea. Instead of improving business operations, a change to something more popular can actually yield adverse results and increase overhead.
Here’s an example of what can go wrong:
You have Ruby on the Backend, but Python is the top dog now, so it’s natural to feel like Python might benefit your business.
But is adding yet another language to your server-side stack necessary? Or maybe it would only make the codebase more confusing and difficult to maintain?
Unless your application is as big as Twitter, business benefits from adding Python won’t be big enough to compensate for the implementation costs.
A better approach is to use what’s available within your current setup and solve the problem with a minimum waste of resources.
When used by experienced developers who are well-versed in building apps in Rails, RoR’s maturity combined with excellent tooling, libraries, and community support makes addressing most of the pressing issues a rather straightforward affair.
Let's look at the state of Ruby on Rails.
Although way behind main contenders, such as PHP or Python, Ruby still makes the cut for the 20 most popular programming languages list in 2022.
The 2022 edition of Stack Overflow Annual Developer Survey also places RoR in a similar spot.
Most popular programming, scripting, and markup languages. Source: Stack Overflow 2022
To dive into what Ruby can be used for, we have to remember that it is a dynamic, general programming language that is versatile and mature.
The list of products you can build with Ruby is very long due to the vast (and still growing) number of gems and libraries, which serve as building blocks for different types of apps.
Here are the most common types of apps built with Ruby.
Ruby is often chosen for the cost-effective and fast development of MVPs. This language is also often used for prototyping, introducing updates, and testing different versions of products before building fully functional apps.
Because of Ruby’s ability to support traffic-heavy apps, it is perfect for social networking apps like Twitter.
It’s also used for apartment sharing and booking apps - Airbnb and Couchsurfing - because it swiftly manages a big amount of daily transactions and property bookings.
Ruby is a programming language of choice for many eCommerce platforms like Spree or Shopify. The reason why it is perfect for the job is the speed of development, flexibility, and cost-effectiveness of Ruby, which allows for managing a lot of transactions at once.
Some of the best examples of such platforms are GitHub - the biggest Git repository hosting platform for developers and Bloomberg - a multi-platform financial news and analytics hub.
Because of its speed, efficiency, and flexibility, Ruby is also used for:
While Rails’ popularity might have dropped off over the years, the framework is still used by over a million websites globally, including by a number of major players, such as Dribbble and Hulu.
Even though PHP and Python are used more widely than Ruby, two of their most popular frameworks, Laravel, and Django, respectively, have significantly fewer contributors than Rails.
A higher number of contributors means gems (libraries) are of very good quality, and as the saying goes, there’s a gem for everything in Rails. Rails is often praised for the effort of its community to create reusable libraries that encapsulate solutions to standard problems.
GitHub contributors to Ruby frameworks:
GitHub contributors to Django (Python) and Laravel (PHP):
If Rails were dead, hiring managers wouldn’t be looking for Rails developers.
Here are worldwide job ads from LinkedIn for Rails, Laravel, and Django along with the languages they’re written in:
Results from Indeed US:
Because the world of Rails is somewhat specific, with many people referring to Rails when meaning Ruby, the analysis above might be slightly inaccurate.
Conversely, many hiring managers mean Django when recruiting Python devs, and Laravel when looking for PHP developers.
With coding by convention, building applications in RoR is fast and easy—an excellent choice if you’re on a tight budget and under tight deadlines.
Thanks to the sizeable talent pool, finding experienced RoR developers shouldn’t take long.
Ruby on Rails is mature and offers stability that directly translates into successful, hassle-free maintenance for years. Good developers will know how to tap the magic of Rails and use the saved time to focus on business features and application logic.
In the hands of inexperienced developers, Rails will never be a good choice for advanced, complex applications.
It can actually be a source of many headaches and future issues with maintenance, performance, security, and stability—all of which incur significant costs that could otherwise be avoided.
For simple APIs or blogs, Rails is an excellent pick, even for beginner devs.
We’ve noticed in recent years a significant increase in the number of applications built with Ruby on Rails in “the API only” mode. Thanks to that, it is possible to quickly create an API as an MVP and at the same time build the Frontend of the application in any JS framework.
What’s more, writing Single-Page Applications (SPA) is getting some traction and it’s one of the strongest trends right now. At Monterail, we’ve already built some SPAs with Laravel Vue Stack, so in 2022 it’s time for Ruby.
Source: Google Trends
In 2022 we can also observe going back to the roots in the Ruby on Rails world with Hotwire. Along with its appearance, we’re finally able to build efficient and modern Web applications within one application, in a very fast way, and without poor development experience. The funny thing is, we’ve been using similar techniques but never in such an organized, cohesive way.
The sprinkle on top of this whole technological stack is Strada. It’s the tools for creating mobile hybrid applications that will elevate Rails to the top solutions for Web applications. Strada’s release is planned for 2022.
Ruby and Ruby on Rails have been facing performance issues for years now but real change has been on the horizon, too. I observe a strong focus on dealing with this aspect and improving the framework and language itself.
The Ruby 3.0 version turned out to be three times faster that Ruby 2.0 and predictions made by Jakuhiro Matzuomoto. Now, version 3.1 takes another step toward better performance. One of the steps was implementing the so-called “Fiber Scheduler” which allows for asynchronous work of Ruby without any side effects or tedious developer’s work.
It means one thing - one of the strongest arguments against Ruby is slowly losing its relevance! Ruby is getting more and more performant, no doubts about that!
Ruby takes a closer look at well-known problems and modifies the way the framework works and makes it towards asynchrony, too. At the beginning of 2022, a new version of the PG gem was released that enables making asynchronous requests to the database. It only proves the general development direction of the Ruby community.
In Rails 7 we finally see one great feature which was long time awaited in Rails. Our databases were never encrypted by default. In general, it does not mean that it was unsecured, but if we can do it, we just should encrypt even simple data in the database.
Now you don’t have to add any gems or additional implementations, you can just use simple command because Rails support encryption out of the box. It’s a really important feature of Rails 7!
Not all changes in Ruby on Rails are thought out in advance. Some of them remind me of an experiment that shows that RoR is not afraid of trying new things. One of such features is Ractor - a Ruby Actor Model which will offer parallel computation capabilities to Ruby apps.
Just to summarize, in the last few years, a lot changed in the Ruby on Rails world.
There are some revolutionary changes, there are some improvements, and some small steps which will be hopefully continued in the next few years. From the perspective of a Ruby developer but also a potential client, these matters are the most important: