Ruby on Rails

From GcatWiki
Jump to: navigation, search

This page is meant to generate interest in Ruby on Rails and Ajax by providing brief "teaser" descriptions and links to more information.

Ruby on Rails

  • "Ruby on Rails is a web application framework written in Ruby, a dynamically typed programming language similar to Python, Smalltalk, and Perl." O'Reilly article


  • "Rails is the most well thought-out web development framework I've ever used. And that's in a decade of doing web applications for a living. I've built my own frameworks, helped develop the Servlet API, and have created more than a few web servers from scratch. Nobody has done it like this before. That's not to say they got it all right. It's by no means "perfect". I've got more than a few nits and picks about how things are put together. But "perfect" isn't the point. The point is that it gets you up and going fast and has plenty of depth to keep you going. And Rails does that very well." O'Reilly article


  • Ruby on Rails, often called RoR or just Rails, is an open source web application framework written in Ruby that closely follows the Model-View-Controller (MVC) architecture. It strives for simplicity and allowing real-world applications to be developed in less code than other frameworks and with a minimum of configuration. Wikipedia article:


  • Rails' guiding principles include "Don't Repeat Yourself" and "Convention Over Configuration". "Don't Repeat Yourself" means that definitions should only have to be made once. Since Rails is a "full-stack" framework, the components are integrated so that bridges between them need not be set up manually. For example, in Active Record, class definition needs not specify the column names; Ruby already can find them from database itself, so defining them in both the program and the RDBMS would be redundant. "Convention Over Configuration" means that the programmer only needs to specifically configure what is unconventional. For example, if there is a Post class in model, the corresponding table in database is posts, but if the table is unconventional (e.g. blogposts), it must be specified manually (set_table_name "blogposts"). Wikipedia article:


links
O'Reilly article about Ruby on Rails[1].
Wikipedia article on Ruby on Rails[2]. It mentions Ajax.

Ajax

Ajax (Asynchronous JavaScript and XML) describes XMLHttpRequest, which apparently has been around since 1998, but didn't really pop up on anyone's radar until several high-profile Google apps utilized it to great success. It is how gmail anticipates your contacts, and how you can keep panning and panning the landscape in google maps.

Here's a great introduction and practical example from the O'Reilly article - if you click any link on this page, click the link to the ajax web app!

Traditional Web App vs. an Ajax App

Let me distill the essence of an Ajax web application by examining a use case: inserting a new item into a list.

A typical user interface displays the current list on a web page followed by an input field in which the user can type the text of a new item. When the user clicks on a Create New Item button, the app actually creates and inserts the new item into the list.

At this point, a traditional web application sends the value of the input field to the server. The server then acts upon the data (usually by updating a database) and responds by sending back a new web page that displays an updated list that now contains the new item. This uses a lot of bandwidth, because most of the new page is exactly the same as the old one. The performance of this web app degrades as the list gets longer.

In contrast, an Ajax web application sends the input field to the server in the background and updates the affected portion of the current web page in place. This dramatically increases the responsiveness of the user interface and makes it feel much more like a desktop application.

You can see this for yourself. Below are links to two different weblogs, one that uses Ajax to post comments and another that does not. Try posting some comments to each one:

Traditional Web App
Ajax Web App

links
O'Reilly article about Ajax[3].
Wikipedia article on Ajax[4].
What Every Webmaster and Web Developer MUST Know About Ruby on Rails and AJAX[5].