What is Ruby on Rails? Where its used and reasons for popularity
The answer to what Ruby on Rails is really depends on where you come from and what is your background. Are you a software programmer or someone familiar with programming or are you non-technical? Because of this I’ve created two different version of the answer, one for technical people and the other for non-technical people. I would advise technical people also go through the non-technical answer as it sets up the stage for the technical one. This is especially important if you are unfamiliar with web development and come from a hardware / desktop application side of things.
The non-technical answer
In simple terms think of it as a tool that used to build websites, but websites that are incredibly dynamic, complex and changes depending on the actions of the user. These are not like blogs (though there are some blogs also built using RoR). These is a whole new category of applications that are so dynamic and so complex behind the scenes that an there is an entirely new word that we use to describe them. We call them “Web Applications”. They’re somewhere between the programs/applications that you use on your laptop by installing and websites. Think of them as applications that are delivered using your browser.
You have probably visited or heard some of these websites such as Airbnb, Kickstarter, Groupon, Hulu, Slideshare, Soundcloud. Yup all these websites are built using Ruby on Rails, and these are just the biggest ones. There are thousands of websites that are built using Ruby on Rails, and this list grows bigger every year. You can find a number of lists by going here. In fact according to buildwith.com almost 5% of the top 10,000 websites on the internet use it. Another thing that you will notice about the companies that I mentioned earlier. They’re all startups or young companies. Almost all of them were started in the last 5-10 years and amassed market caps from the 100s of millions to the billions of dollars in that time. There is a reason that these companies and many other startups like them choose to use frameworks like RoR, I will explain why later in this post.
To really understand what Ruby on Rails offers and why it became so popular we have to step back a little. Lets talk about the physical world, lets talk about factories. Say you are an entrepreneur / company or with an idea for a physical product. So you want to build this product and to do that you need to create a factory. But you don’t know anything about factories, they’re really big with a lots of complex machinery that are scary. You just want to create this product and you don’t really want to think about setting up conveyor belts and assembly lines. You just want to create the product, get into the market and into the hands of your users. The difficult thing about creating factories is that there are no standard ways of doing things, each factory is different. Yes there are certain practices but in general there are numerous ways your factory could be setup. You wish there was a standard way of doing something but there isn’t, there isn’t a blue print that you just plug your stuff into.
Now switch the product with a web application. You want to create a website and not have to worry about all the stuff in the background. You just want to create an awesome website and get it into the hands of your users. Thats what ruby on rails does for websites, it creates a standard blueprint that you can hire programmers to plug into and create a basic first version of your web application. After you have created that it grows with your team allowing you to build on that first version. But I’m going to expand on these ideas in the next section.
The Many reasons for its popularity
Its Open Source, what it means is that Ruby on Rails is free and anyone can use it without paying anyone. Yes! its true, its 100% free as in a free lunch. In fact you can go and download the entire source code now at github.com/rails/rails. But thats not all - anyone can contribute back to the source code and make it better. Lets say you are a company that is using it but you think it needs a feature that it does not currently have. You could go to Github and contribute that feature and people from all around the world would use it. Now when I say its open source and anyone can contribute does not mean that its a free for all. There are people who manage the list and make sure that what you’ve contributed is actually useful to everyone and the quality of the code is good. This is how actually rails has been developed and maintained for the past 10 years. There are volunteers that create the code and give it away for free.
It also has an incredible community behind it, just because something is free does not make it useful. But what really separates ruby on rails from the rest of the pack is that there is incredibly talented and passionate community of developers behind it. Because of this community you can find almost any major functionality for free that can be plugged into your application. These are really useful when you are a startup and want to create all functionality as fast as possible.
You will also notice that the list of companies that I mentioned previously was dominated by startups and you would not have heard of them just a few years back. One of the reasons that Ruby on Rails is incredibly popular with startups is because it allows you to create a first version of your website really fast. There are companies that have created websites and gotten users in as little as a few weeks. The power of open source/free makes it incredibly appealing to startups.
The slightly more technical answer
This is the shorter more technical answer. If you have done any software development then you should be able to understand this section.
Ruby on Rails is essentially a framework for creating web applications. Right off the bat I want to make the distinction between Ruby and Rails. Ruby is the programming language that wad created independently of Rails in the 1990s. Rails is the framework that was created by DHH around 2005.
Ruby is a language that was designed for programmer happiness in the words of its creator Matz. Its completely object oriented. The syntax is slightly different but starts to make sense more as you learn it.
Rails is the framework that was written in Ruby for creating web applications. This distinction is important to understand. Rails follows the MVC design pattern. Models contain businesses logic and interact with the database to persist data, Views are responsible for showing data and controllers manage the interaction between the View and the Models.
Gems are another thing that make Rails really powerful. Gems are essentially libraries and ruby programs that have been bundled into a standard format for distribution. There are 1000s of gems covering a lot of things that one might commonly need while developing a complex application. You can browse the most important gems at RubyGems.org
Testing is encouraged in the Rails world and Test Driven Development and Agile programming are very popular with Rails developers. Some popular gems for testing are Rspec and Capybara.
Engines are another powerful feature of Rails, they allow you to essentially plug in another application into your main application. Its commonly used for things like adding a CMS backend for a blog, an plug and play Admin panel or e-commerce.
In all the Rails ecosystem has matured really quickly since its launch a decade ago. There are more websites that use Rails and its the framework of choice for many companies building web applications.