Friday, November 07, 2008

DRY and CoC On Ruby on Rails

Often shortened to Rails or ROR, Ruby On Rails is a project written in the Ruby programming language and applications using the Rails framework that is developed using the Model-View-Controller Design Pattern.

ROR being ‘instant-web development’ is largely gaining grounds in the web development world. Its a free web application framework, which intends to increase the speed and straightforwardness with which database-driven web sites can be created and offers skeleton code frameworks from the outset.

The fundamental Ruby on Rails principles includes Convention over Configuration (CoC) and Don't repeat yourself (DRY).

"Convention over Configuration" means a developer only needs to specify unconventional aspects of the application. For example, if there's 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 one needs to write code regarding these names.

By "Don't repeat yourself" it means that information is located in a single unambiguous place. Like, using Active Record, the developer does not need to specify database column names in class definitions. Instead, Ruby can retrieve this information from the database.