Lost Password?
Register now!
Page « 1 (2) 3 4 5 ... 9 »
Articles : Web Development Using the Ruby on Rails
on 2008/7/27 23:54:31 (2890 reads)

What is Rails?

Ruby on Rails is a full stack, cross-platform open source framework. David Heinemeier Hansson originally wrote it, but in the meantime there is already a small group of core developers working on it. It often is abbreviated to 'RoR' or 'Rails' and the latter will be used throughout this article. 'Full stack' means that all the parts needed to build a Web application are present. Instead of having to learn different frameworks and tools and trying to get them to work together, the different Rails layers fit together seamlessly, which makes it a joy to work with! It runs on all major operating systems like Linux, OS X and Windows; it supports the most common open source databases like MySQL and PostgreSQL but also SQL Server, Oracle and others. It uses any Web server that supports CGI, the most popular being Apache and Lighttpd.

The entire framework is written in Ruby, a language which has been around for a while but whose popularity has exploded since Rails hit the scene. The language originated in Japan in '95 by the hands and brains of Yukihiro "Matz" Matsumoto, sort of as better, more object-oriented version of Perl. It harbors the same power as Perl does and yet is as fully object-oriented as SmallTalk. Its syntax also closely resembles these two languages. Ruby is an interpreted language, meaning it doesn't need to be compiled before execution. Everything in Rails is done in Ruby: from the configuration (the little there is) to the domain model and the Web pages, you only need to know one language. Given the dynamic nature of Ruby there is no development environment for it like Eclipse for Java or Visual Studio for .NET. You can develop in any text editor you like, although an editor with the notion of a project and syntax coloring is recommended. On Windows Eclipse with the Ruby plugin, FreeRIDE or Arachno Ruby (commercial) are popular, TextMate is the reigning editor on OS X, but no one keeps you from using vi, Emacs or even Notepad. There is even an open source editor specifically for Rails, called RadRails.

One of the selling points of Rails is that it is built with the DRY principle in mind. DRY stands for Don't Repeat Yourself, meaning that every piece of your system is described once and only once, which should make development and maintenance a lot easier since there is no need to keep multiple parts of the code in sync. Hand in hand with DRY goes 'Convention over Configuration', another one of Rails' core philosophies. Rails uses a set of code and naming conventions that when adhered to eliminates the need for configuring every single aspect of your application. Only the extraordinary stuff needs to be configured, like legacy database schemas or other resources you don't control. Using these two philosophies, DRY and 'Convention Over Configuration', Rails lets you write less code AND more features in the same time as with a typical Java or .NET application, with easier maintenance afterwards.

Rails is an MVC framework, which means your application is divided into three layers: the Model, the View and the Controller. Rails consists of several separate libraries. The two most important, which implement the MVC paradigm, are ActionPack, which takes care of the View and the Controller layers and ActiveRecord for the Model layer.

Page « 1 (2) 3 4 5 ... 9 »
Printer Friendly Page Send this Story to a Friend Create a PDF from the article