Ruby is an interpreted, high-level language written in C and released in 1995. Its designer and chief developer was, and still is, Matsumoto “Matz” Yukihiro, a Japan-based software engineer.
Matsumoto originally envisioned Ruby as an object-oriented scripting language, one that would fit the same space that Perl had at the time. But little did he know that his relatively small scripting language would grow to become a web development juggernaut.
Enter Ruby on Rails
A decade after Ruby was originally released to the public, David Heinemeier Hansson derived the server-side web application framework called Rails, based on Ruby, from his work on the project management tool Basecamp.
Rails would remain relatively unnoticed until 2006 when Apple announced that they would be including Ruby on Rails (the full name of the framework) with MacOS X 15. That was a turning point for the framework, which led to a whole generation of developers adopting it as a backend solution for their web apps.
Much like Django (another framework based on Python released at the same time), the idea was to provide developers with a set of tools that would let them quickly create web applications in exchange for some flexibility. A bit like the DIY furniture of software development.
Ruby is a very friendly and readable language. Give a non-developer a simple Ruby script and they will get a pretty good idea of what it’s trying to accomplish. This is one of the language’s biggest strengths and something that Rails took to heart.
Rails is the backend solution of some of the most popular web pages, including GitHub, Airbnb, Shopify, Hulu, and Zendesk. After 16 years of continuous development, its community and resources have grown steadily, becoming one of the most supported frameworks on the market.
What set Ruby on Rails apart from its competition and what drove the adoption of the framework was its ease of use. But one look at Stack Overflow Developer Survey reveals that Rails is no longer the most popular kid on the block.
Is Rails on its way out?
A lot has changed in the last 16 years. Python 3.0 was released in 2008, overhauling many aspects of the language for readability and ease of use. This led to its widespread adoption as well as a rise in popularity in Python-based frameworks like the aforementioned Django or the minimalist Flask.
While not as popular as it once was, Rails isn’t going anywhere: it’s widely used, actively developed, and has a strong community that pushes for its adoption. Having said that, if it were to go away, can Ruby survive without its killer framework?
Ruby as a programming language
Ruby is, first and foremost, an all-purpose scripting language. Anything a Python script can do, Ruby can do as well. Python may be faster (for an interpreted language) and use less memory on average, but for many developers, it’s still a more elegant language that’s easier to read and work with.
Ruby has a few core ideas that underlie its design choices:
- Focus on humans: for Matsumoto, the fact that humans have to think like machines to write code is cumbersome and anti-natural. A programming language should be as close as possible to the way people speak and think. In short, it should make the developer’s life easier.
- The path of least astonishment: software developers feel like Ruby fits this principle rather well. When you learn something new in Ruby you should be the least surprised person in the room. In other words, the language should be clear enough that you are well aware of what’s going to happen when you run the code.
- The Joy of Programming: Freedom breeds creativity, and Matsumoto believes that a developer is most happy when they get to work on the creative aspect of writing code. As such, Ruby is made with creativity in mind. That’s why, like Perl, one of its core strengths is that it has more than one solution to the same problem.
Ruby Vs. Python
As a programming language, Ruby has it rough, mainly because it shares the same space as one of the most popular programming languages in the world, Python. The latter is well regarded as a language that’s easy to get into and has a massive developer community backing it.
But popular doesn’t necessarily mean better. Developers who favor Ruby often cite its flexibility and rather loose structure as a strong point. To put it in simple terms, Python is the easier language to get into, while Ruby is the more elegant, even if that comes at the cost of a steeper learning curve.
Ruby can be pretty flexible in places where Python is rigid. For example, strings are mutable in the former and immutable in the latter. It’s a minor thing, but it’s a very clear case of the underlying philosophies of each language.
For people that embrace Object-Oriented Programming in earnest, another point in Ruby’s favor is that it is fully OOP. Python is not, because even when it has classes, inheritance, and methods, it does not support strong encapsulation.
Python’s developer community is impressive, but Ruby’s is more stable and, while it takes longer to create new technologies, it tends to be more consistent. It would be a disservice to say that it’s quality over quantity since both communities create amazing tools, but you are less likely to run into a bug with Ruby’s libraries.
Ruby: The prototyping language
Outside of web development, Ruby has a reputation for being a pretty solid language to write prototypes and proof of type at the earliest stages of software engineering. This might make it sound like a second-class language, but that couldn’t be further from the truth.
Prototypes need to be built fast, and they have to be very simple and easy to change on the fly, which requires a code that’s easy to follow and modify as new ideas are tested. Ruby’s strengths make it ideal for quick scripts or for programs that are going to be seeing a lot of change in a very short amount of time.
Ruby might not be at the top of the charts, but much like R, it has a very strong and dedicated community that’s keeping it alive and doing everything in its power to spread its love for a language that can be as powerful as the most popular alternatives on the market.