Would you like to invest your time and efforts to learn a language that will no longer be relevant in a couple of years?
I have read two kinds of posts on the Internet. Those stating "Ruby is dead" and those who list Ruby as one of the top languages to learn.
To make up your mind and decide if Ruby is a good choice, you should rely on some facts about it, and that's the goal of this article.
Ruby is a dynamic Object Oriented language, which allows you to design your applications using Composition, Inheritance and Interfaces. In Ruby how the object behaves is more important than what the object is. That's called Duck typing.
Dynamic means that you can create methods and classes at runtime. That allows defining Domain Specific Languages (DSL), which seem to extend the language with new functionalities.
For instance, ActiveRecord defines a DSL to create associations between models. Consider this code:
class Author < ApplicationRecord has_many :books end
has_many seems to be part of the language, but it is just a method call that adds many methods to the model Author. Often people call this trait "Ruby Magic".
The best book on OOP in Ruby is Practical Object-Oriented Design: An Agile Primer Using Ruby by Sandy Metz.
Yukihiro Matsumoto and the Ruby community are continually improving Ruby. They recently released Version 3, which is three times faster than version 2. That was an achievement since speed has been a weakness of the language.
Thanks to Ruby on Rails (and other web frameworks), Ruby stands out for Web development and API building.
A new Ruby on Rails version (the 7th) is about to be released. RoR is an old framework - the initial release was back in 2004 - but continuous updates make it modern, stable and suitable for a wide range of Web applications.
Some companies are happy to hire and train developers skilled in other languages to code in Ruby since Rubyists are not easy to find. I coached some Python developers to work on Ruby projects. They caught up pretty fast, even though there are few concepts new for Pythonistas - it is not just syntax.
In the UK, various Gov departments use Ruby in many projects. I've worked at Dep. for Education, Ministry of Justice and HMRC, and there is a high demand for Rubyist to maintain and expand those projects, which must continue to serve the citizens for many years.
One of the criticisms to Ruby is about being slow. The reality is that, in a complex web application, speed is more than just choosing a fast language. The design and architecture of the whole system are involved. I've seen web applications going ten times faster after fixing the N+1 queries problem. In that case, the language was not the cause of the speed problem. It was the poor way the app retrieved the data.
One last thing to consider is that in most Startups, time-to-market is vital. Solving the problem and getting feedback from the users first is more important than focusing on performance. A team that gets feedback soon, can quickly react to correct and improve the product.
That's why many startups are still choosing Ruby on Rails.
Finally, there are reasons not to choose Ruby. If you don't care about building web applications, there are better choices.
Those are just a few examples of choosing the right tool for the job. If web applications are your thing, then the time and efforts you spend to learn Ruby will be worthwhile.
My previous article is about how to build maintable Ruby on Rails applications.