views:

432

answers:

8

I am a front end developer (HTML,CSS,JS & jQuery) I know a bit of PHP. I am trying to grasp what Ruby/Ruby on Rails is.

On http://rubyonrails.org/ it says "Ruby on Rails is an open-source web framework that's optimized for programmer happiness"

In actual, non-dreamy terms, what is special about Ruby/Ruby on Rails, and how can a person like myself benefit from learning to use it?

My simple question is: whose sister is it? PHP, mySQL, ASP, coldFusion, jsp, apache?

What does it do?

+4  A: 

It's a framework for Ruby whose sweet spot is CRUD based web apps. They make a number of assumptions (aka "conventions") that make it easy and fast to create tables with 1:1, 1:m, and m:n relationships, objects, controllers, and web pages for exposing and manipulating that data on the web.

Ruby is just another object-oriented language, like Java, C++, or C#. It was invented by a gentleman from Japan.

duffymo
thanks, I ask a simple question: what is Ruby? is it the same kind of language like PHP ASP? server db generated content?
adardesign
Ruby is in the same category of thing as PHP, that is a dynamic, interpreted, scripting language, however it is object oriented and has some clever features that make Rails easy to use.
jleedev
Also worth noting that Ruby is dynamic unlike Java, C++ or C#. Which means a lot of things, most notable is that class in Ruby can opened and modify classes on fly.
EmFi
+2  A: 

Philosophy and design

Ruby on Rails is intended to emphasize Convention over Configuration (CoC), and the rapid development principle of Don't Repeat Yourself (DRY).

"Convention over Configuration" means a developer only needs to specify unconventional aspects of the application. For example, if there is a class Sale in the model, the corresponding table in the database is called sales by default. It is only if one deviates from this convention, such as calling the table "products sold", that the developer needs to write code regarding these names. Generally, this leads to less code and less repetition.

"Don't repeat yourself" means that information is located in a single, unambiguous place. For example, using the ActiveRecord module of Rails, the developer does not need to specify database column names in class definitions. Instead, Ruby on Rails can retrieve this information from the database based on the class name.

Taken from wikipedia

khelll
+3  A: 

This might not be the best analogy, but like you would use HTML/CSS/JS to display a cohesive entity with specific stuff in their specific places. Rails provides a framework to allow you to work in an organized environment with specific stuff in their specific places. As well as having goodies to provide for more rapid development.

Generally:

Html would contain the content you want to display, while CSS would help control the specific look of that content, while JS would allow you to manipulate or interacte with said content.

Rails, uses MVC (Model, View, Controller) to provide a similar organization. Where Data objects are generally categorized as Models, while Views control the displaying of the Data. And Controllers would would facilitate the flow of that data from View to Model and vice versa.

Rails is not the only game in town. So do look around, as there are other great frameworks out there, and find the one best suited to your style and language needs.

nowk
+21  A: 

The Language

Ruby is a recent programming language that shares most of its heritage with Perl and Smalltalk. You can see what Ruby looks like (and try it yourself) at tryruby.org.

Just like you can use PHP to write web pages, you can do the same thing with Ruby.

The Framework

Ruby on Rails is a set of software devices that help you to more easily write a website in Ruby. The primary things they try to facilitate ("make easy") are:

  1. Storing related data (e.g. blog posts and the comments on them) to a database.
  2. Accepting web requests and respond to them programmatically (e.g. check a user's password)
  3. Composing HTML using your data, with layouts and templates to make it easier.

"Rails," as it's called for short, is built with extreme prejudice towards certain application models, particularly MVC. What this means is that unlike PHP, where any .php source file is fair game for any bit of code, most code in a Rails application is written in a particular, conventional place. When people compare Rails to PHP, they often point this out.

There's a lot I didn't cover, but these are Rails' most basic features. To see what it looks like, I'd suggest watching the infamous, "Creating a Weblog..." screencast.

Andres Jaan Tack
Great answer! However, I'm not sure about characterizing Ruby as a "recent" language. Yes, compared to Fortran, it's recent. But it's also older than PHP, C#, VB.NET, and almost as old as Java (indeed releases the same year), none of which one would typically call "recent".
Jörg W Mittag
Wow, I guess it did appear in 1995. Interesting. I wonder why I thought it was so much newer.
Andres Jaan Tack
Like Python, Ruby is a language that experienced popularity a long time after it was written. I had never heard of Ruby before 2004, but I had certainly heard of Java!
James Thompson
Rails is new, though, isn't it?
Platinum Azure
@Andres: Probably because it didn't gain a lot of popularity until RoR came out?
Mark
+4  A: 

If you're looking for something to compare it to for someone coming from PHP, think of it like CakePHP for ruby. It's a bunch of pre-developed low-level classes and systems that can then be extended out to use in many different systems. It also bundles in a lot of other helpful tools and a plugin architecture. It uses ruby and an HTML templating language based on ruby (erb) rather than PHP.

Seburdis
+1 for CakePHP example.
JCasso
+2  A: 
  • Ruby
    An elegant object-oriented programming language with objects like Smalltalk and syntax something like Python and Perl. It's kind of what PHP would have been had it been done right. That is, Ruby takes features from advanced "real" languages and combines them with the interpreted efficient syntax and library-rich practicality of Perl, Python, and PHP.
  • Rails
    An advanced web framework. Many recent web frameworks are considered to be copies of or at least inspired by Rails. (Google "rails clone".) "The first good web framework".

Both Ruby and Rails are generally highly regarded.

DigitalRoss
Yes, Ruby and PHP have such a common ancestry that they lend themselves perfectly to direct comparison.
Azeem.Butt
Well, they are almost exactly the same age, so each would have about the same sort of *potential* technical background.
DigitalRoss
+1  A: 

Ruby is a programming language. Ruby on Rails is a piece of software written in Ruby, it helps you develop web applications.

You can look at Ruby on Rails as if it is a set of tools. It helps you do common tasks when you're making a dynamic web application. E.g. session handling, cookies, database interaction, etc.

Rails goes beyond being just a library, though. To really understand this, you would have to experiment with it, which is actually very easy.

Rails Guides is a fantastic place to start.

Blaine LaFreniere
+2  A: 

Ruby is an object oriented programming language. Rails is a framework built in Ruby for developing web applications. I have been using rails for about 6 months now, and its been great so far. If you want some of the same features of rails, you should also consider django (python), cakephp or symfony (php).

Pros:

  • MVC Architecture - Code is organized, broken up into small, manageable
    files
  • Database abstraction - you dont have to write SQL queries, database types are easily interchanged
  • Convention over Configuration - rails automatically knows file, database, variable names without explicitly being specified
  • Fast Development - Rails requires less lines of code because of all the functions it automatically takes care of and is more expressive, resulting in faster development

Cons:

  • Slower - this is often debated, but a comparable rails application is slower than its PHP counterpart. Rails 3 is supposedly going to include speed increases.
  • Less Literature - rails lacks the plethora of tutorials, books and api that is available for PHP.
  • Less Hosting Support - Not all shared hosts support rails, but you can set it up on any vps or dedicated. Deployment is also a bit tougher in Rails as opposed to PHP
cmpolis