What is Ruby on Rails?
Ruby on Rail follows the MVC (model, view, controller) style of framework. Models store the information, the view shows it, and the controller works between the two to control it. Ruby on Rails also comes with Gems. Gems are libraries of Ruby programs that have been made into a standard format for installation so that they are plug and play. There are thousands of Gems available, each providing for a unique and often required need when putting together a web app.
Now that we have some background on both languages, let’s look over them and figure out which we might prefer over the other. We will take on this task by comparing them head to head on a few different fronts.
Typing and Syntax
Ruby is built for usability. Its philosophy is that there is more than one way to do something. So not only does Ruby have a simple and easy to learn syntax, it has a syntax that’s designed to be used however you like. It’s very high-level, no variable declarations or semicolons, just easy to read code. It’s also more object-oriented than most other object-oriented languages. It’s so object-oriented that everything is an object, with methods and functions, even simple integers. Because of this, programmers can use method chaining; where a lot of code can be reduced into a little bit of code.
However, since Ruby is so loose in how it allows the programmer to use it, it can be difficult to pass code between programmers. Code that would normally be several lines can be reduced to a few, and then down to one line after that. While code that is this clean is prettier to look at, it can also be as hard to read—or harder to read—than the same code laid out in many lines. A single line of code that should be many can be difficult to decipher. Because it is relaxed, Ruby also allows for very inefficient methods of programming and doesn’t require anyone to adhere to a ruleset for programming, even if they should.
Also, because Ruby is so high-level, debugging can be a nightmare. Ruby is particularly abstract so finding what line of code is rubbing the interpreter the wrong way can be difficult. It’s not as easy as missing a semicolon, and often times it’s related to an unseen interaction that happens under the hood, or is equally buried under an immense stack call.
It’s important to note that Ruby is slower in a benchmarking situation. This is when we throw something difficult to figure out and then measure how long it takes for the language to figure it out. In the real world when building a web app you won’t always need to solve Mandelbrot fractals. In this sense, many Ruby fans argue that Ruby is fast enough—that it’s only slow when compared to other languages—but that it functions fine otherwise. This topic is under intense debate, however, there are plenty of functional examples of Ruby performing fine: AirBnB, Kickstarter, or Apple.com to name a few. Performance generally only becomes an issue if perfect timing or large and complex calculations are necessary.
At time of writing Indeed.com features over 16,000 job listings for Ruby developers and programmers in the US alone. Ruby developers also make a lot of money. An average Ruby developer can typically expect to make somewhere between $50,000 to over $200,000 each year. According to Indeed, where all of those jobs are listed, the national average for a Ruby developer in the US is $123,154 per year.