Many programming languages become trendy, enjoy a peak, and sooner or later fall out of favor. Today, people are talking about Ruby's decrease in popularity and even its alleged death. Here's why I think Ruby remains a solid programming language and Ruby on Rails a reliable web application framework. 

First, What Are Ruby and Ruby on Rails?

Ruby on Rails is a web app framework written in Ruby, a dynamic, general-purpose programming language. Many people get confused about these terms, thinking "Rails" when hearing "Ruby," but rarely the other way around.

This is perhaps because Ruby made a name for itself after releasing Ruby on Rails. Also, most Ruby programmers use Ruby on Rails. There are a lot of other Ruby frameworks, and they are not necessarily lower in quality than Rails. In fact, most of them were built to outperform Rails in some way.

Back in 2005, Ruby on Rails changed the web developer world with its new approach to building web applications through its convention-over-configuration software design paradigm that facilitates developer work on many levels. For example, if there is a sales class in the model, the corresponding table in the database is called “sales” by default. It is only when deviating from this convention, such as by naming the table “product sales,” that you need to write code for these names.

Ruby on Rails is based on the MVC (Model View Controller) design pattern. This enables efficient development with parallel developers working on models and instances.

Why Do So Many People Think Ruby on Rails is Dead?

There is no easy answer to that question. It’s as if Ruby on Rails has been around long enough that it's lost its fascination, so new programming languages are coming to take their place on the stage instead. Also, the many myths of RoR’s demise are the result of many misconceptions that grew around the framework. In fact, there are several examples of how RoR still works well when paired with well-thought-out architecture like Basecamp, Airbnb, and GitHub. 

So Why the Bad Reputation?

Ruby on Rails is thought of as a good programming language to do an MVP or a beginning-to-programming learning path, and it does a lot for the developer. Inexperienced engineers, however, tend to make poor architectural decisions and create a lot of bad code, which causes a significant drop in performance. Often, people attribute this poor performance to RoR itself instead of to the poor architectural decisions.

Another critique of RoR is its scalability issues. This Ruby on Rails issue became widely known in 2009 when Twitter decided to move  its message queue back-end from Ruby to Scala. Still, let’s keep in mind that we’re talking Twitter-size traffic here. It’s not that Rails doesn’t scale, but rather, requests for “live” data in Ruby (or any interpreted language) do not scale, as they are comparatively far more expensive, both in terms of CPU and memory utilization, than their compiled language counterparts.

Ruby performance issues are actively being worked on, and Ruby 2.6.1, released in December 2018, made a lot of improvements. Also, the developers behind Ruby 3 aim to speed up the language by three times compared to Ruby 2. So, before condemning Rails, try to identify which element is responsible for its challenges.

The Actual State of Ruby on Rails

In 2018, cloud computing giant AWS added Ruby to its serverless computing solution , AWS Lambda, right next to Java, C#, Python, and Node.js, proving Ruby's stability as a programming language.

The Ruby on Rails framework has over 3,500 contributors on GitHub. Frequent updates and new gems created by developers ensure that the applications created using this framework can be developed more easily and delivered faster.

Ruby on Rails is among GitHub's top 10 active repositories and has ranked up in the TIOBE software quality index.

Ruby's popularity may have slowed in momentum, but it is far from dying, especially since a vast amount of existing projects and major players like GitHub, SoundCloud, Airbnb and Ask.fm are using the language. With updates at least twice a year, the Ruby language is constantly evolving. And Ruby is not only Rails; Ruby's other lightweight solutions like Sinatra, frameworks offering different approaches like Hanami, and even frameworks for event sourcing are all gaining in popularity and are improving on what Ruby offers.

This year Ruby on Rails 6.0 was released with parallel testing and bulk insert and upsert, and 6.0 has finally added support for multiple databases. Perhaps another notable feature for many applications that play with WYSIWYG editors is the addition of support for Trix editor natively into Rails 6 applications. This will certainly be a good upgrade/addition for many projects.

In December 2020, we'll have Ruby 3x3, promising to be 3 times faster and to include type checking. 

So, Why Should You Use Ruby on Rails?

Large-scale projects can benefit from using Ruby on Rails as a prototyping tool or an efficient way to deliver proof-of-concept solutions. With coding by convention, building applications is fast and easy.

Ruby on Rails is great for startups and internal tools thanks to its intuitive, simple, and readable syntax, resulting in much higher productivity. Faster development means a quicker time to market, which is important for startups with a limited budget. This way, more money can be invested in the development of additional features.

It is not uncommon to use Ruby even for large and high-performance applications. But it's important to note that using Ruby in this way requires engineers who know how to craft high-performing applications in Ruby. Also, this use of Ruby might require some horizontal scaling.

Ruby focuses on simplicity. It's a programming language that is expressive, not verbose, and is easy to understand. Unlike other programming languages and frameworks, Ruby on Rails does not need complex configurations that add little value to the main application. This saves developers from writing large pieces of complex code.

It offers many easy-to-use built-in tools and gems that ensure operational security and safety. For example, newly created Rails applications have by default a one-liner configuration protect_from_forgery with::exception to protect against all other forged requests.

Tools like Brakeman let developers check Rails applications for security vulnerabilities, and rack-attack mitigates abusive requests, allowing developers to rely less on short-term, one-off hacks to block a particular attack.

Ruby on Rails encourages both test-driven development (TDD) and behavior-driven development (BDD). Both of these development principles advocate writing tests first and then developing code to ensure these tests pass.

RSpec is a widely accepted domain-specific language testing tool for Rails applications. With Rspec, tests are written beforehand, which means developers can avoid writing unnecessary code, making it easy to do refactoring. Its simple syntax makes it one of the most widely used testing tools for Ruby applications.

Last but not least, we should keep in mind that there are no bad programming languages, there are only poorly chosen languages for particular use cases. So if you feel Ruby seems to be a great fit for you, do not hesitate to use it. It is still among the top most popular technologies!


Author

Magnum Fonseca

Magnum Fonseca is a Software Engineer at Avenue Code and Thor's father in his free time. He loves to play videogames, walk in the park, and enjoy a good beer.


Takeaways from RubyConf São Paulo 2019

READ MORE