Ruby and Ruby on Rails are the same thing, right?

Published July 27, 2014, by @jhendge

Ruby != Rails

If you're wondering why the boy in the image above looks so surprised, it's because he just learned that Ruby and Ruby on Rails are two entirely (well, mostly) different things. That's right. Ruby is a programming language, like PHP or Java, that has its own rules and syntax with which you can use to write awesome programs and web applications. Programs include but are certainly not limited to desktop applications, command line scripts for automating tasks on a computer, and web applications.

A web application - like Google Docs, Hulu, Hootsuite, Bit.ly, etc. - is any software that runs in a web browser and relies on that browser to generate the application. These applications typically accept user requests (i.e. shorten a link or send a tweet) over http and respond with html or an alternate data format. You can write fully functional web apps from scratch in Ruby, but that can be totally overwhelming. After all, it would be nice to get some help handling multiple types of requests, storing data, and rendering specific information as html (among other things), right? This is where Rails comes in.

If Ruby != Rails than Rails = ?

If you do a quick search on the Internet, you'll find this terrifically unsexy defition of Rails (thanks Wikipedia): "Rails, is an open source web application framework which runs via the Ruby programming language. It is a full-stack framework: it allows creating pages and applications that gather information from the web server, talk to or query the database, and render templates out of the box."

I think what Wikipedia is trying to say is that Rails is a set of tools that makes writing web applications easier and simpler to maintain. How does it do this? Well, Rails allows development teams to focus on the parts of their applications which are unique to their goals without having to resolve common development issues. Because of this, Rails allows programmers to write less code while accomplishing more than other frameworks like Djanjo, Drupal, and Symfony. Less code to write means a (hopefully) simpler program, and a simpler program means decreased chances for potential code errors.

Rails Principles

Finally, Rails prides itself on being "opinionated software." It assumes that there is a "best" way to do things and as a result, is friendly for those that follow its two major guiding principles: Don't Repeat Yourself (DRY) and Convention Over Configuration (CoC).

DRY suggests that information should not be written over and over again and that if a similar series of statements can be condensed, it should be. This allows for a faster program with fewer bugs that can be easily maintained. CoC is a design paradigm which aims to decrease the number of decisions that developers need to make. How does it do this? Remember, Rails has opinions about the best way to do things in a web application and would like to do things its way. As such, programmers don't have to define every little thing and instead can focus on the main ideas behind their web apps.

So there we have it - the difference between Ruby and Ruby on Rails. Now you can see why that little boy was so shocked!