Ruby on Rails
What is Ruby on Rails?
"Rails is a full-stack open-source framework for developing database-backed web applications according to the Model-View-Control pattern. From the Ajax in the view, to the request and response in the controller, to the domain model wrapping the database, Rails gives you a pure-Ruby development environment. To go live, all you need to add is a database and a web server". Visit http://www.rubyonrails.org/ for more details.
And it's absolutely free.
Features of the framework:
- MVC Architecture: Ruby on Rails is based on the MVC (Model View Controller) architecture that enables the data to be separated from presentation
- Database Access Library: Ruby on Rails includes a database access library - Active Record - that simplifies data handling in databases. Active Record automatically maps tables to classes and rows to objects
- Full use of OO concepts: at program and data model level: mixins, inheritance, duck typing, polymorphic associations etc
- Libraries for common tasks: Ruby on Rails includes a host of libraries that simplify the coding of common programming tasks such as form validations, sessions management, etc
- AJAX Library: An extensive library of AJAX functions is provided in the Rails framework. Ruby code can be used to generate AJAX code. The associated java scripting required for AJAX gets generated automatically
- Convention over configuration: Ruby on Rails does not have any XML configuration files. It includes simple programming conventions that can be used to specify the configuration parameters
- Caching: page caching, action caching, fragment caching, database calls and so on
- Build in validation and callbacks: Rails implements a simple mechanism to validate data before they can be written to the database
- Transactions: concept of protective blocks around set SQL statements where "if one should fail all will be rolled back" to its previous state promoting database integrity
- Generators: helper scripts that generate code for your application
- Security: RoR framework is very conscious about security
- Seamless script.aculo.us and prototype integration built into the framework
- Availability of hundreds of plug-ins for your every need
- Automated deployment with Capistrano which makes application deployment a breeze
- Wealth of code optimisation tools to help find poorly written code, memory leaks, performance bottlenecks etc.
Ruby on Rails is young, buzzzzing, hip and shinnnny!
RoR has been around for over 5 years with a strong following all around the world. It is becoming very popular in agile development competing with already established Java, PHP and Microsoft based frameworks. RoR is well known for its ease of configuration, ease of development, well thought after framework, promotion of convention and convenience over configuration. Agile development techniques make development incredibly fast with RoR making development costs relatively low.
What makes RoR so special?
In one word "productivity". Should you compare RoR with J2EE? It's almost two fold. In other words RoR can reduce your development time by half compared to J2EE.
Do any of the following appeal?
- We are a start-up (or a small medium sized) company who are very conscious about the development and software licensing costs...
- Our development schedule is very ambitious. We simply can't afford to wait many months to see a stable working product
- Our business rules are quite dynamic and subject to change; hence the application should be built on a framework that can adjust to change without too much hassle
- There should be room left for scaling up. In the future we aim to scale up the application in parallel to the growth of the company attracting a wider range of audience and increasing web traffic; of course with minimum cost
- We would like the application to be Web 2.0 feature rich. Attracting many customers to our web site is paramount to us
- We would like to keep our support budget to a minimum. The technology should allow for application bug fixes and enhancements to be less time consuming
- We would really like a RESTful application if possible. Because we think it's cool.
If any of the above appeals to your company you should look no further than Ruby on Rails.
Web 2.0 and REST ready
The framework promotes web 2.0 interface design, AJAX natively. Latest Rails 2.0 has been developed with RESTful application development at its very core giving developers the best of both conventional and REST features.
What is REST?
REST (Representational State Transfer) is a concept or a principal (not a standard) which is different from the traditional ways of developing and interacting with a networked application. It looks at a website or any networked application as a collection of resources each of which adhere to four basic operations; CREATE, SHOW, EDIT and DELETE. Together with the two "forgotten" HTTP methods PUT and DELETE, REST can bring an application to life with a finite number of fields (as opposed to RPC) on every resource, making interacting with a resource extremely easy. It is a simple but powerful concept that can greatly increase simplicity and add value to an application due to the nature of its core principals.
For a more details look at REST principals please follow this link: http://en.wikipedia.org/wiki/REST.
Rails has been developed with RESTful (applications built according to REST concept) application development at is very core making development a breeze. Bear in mind that there is nothing stopping anyone from developing a RESTful application on J2EE or any other framework but it is in the nature of Rails itself to promote this concept.
Is RoR suitable for you?
Whether you are a small, medium or large organisation RoR can be for you. RoR can be customised and optimised for your every need.
If your target audience is a special group of customers and not the general public, deploying your RoR application with built in FastCGI on Lighttpd web server can be sufficient enough.
However, MySQL database backend is recommended and deploying the application with an nginx (web server) "reverse proxying" to a mongrel (a fast HTTP library and a server for Ruby) cluster for your production application server is also recommended. Cache almost anything with Memcached to boost performance. In terms of Linux distro for your servers it can be RedHat, CentOS or the purpose built highly optimised Gentoo.
Is RoR scalable?
Absolutely, a little googling will reveal many success stories. With light-weight fast web servers, caching technologies to the best open source database servers RoR is a feature rich framework. With organisations such as Yell, social networking websites like Twitter to popular facebook applications like Friends for Sale, RoR has proven to be a scalable and versatile framework that can handle many millions of requests daily.
If you are looking for a low cost but brilliant agile application framework that can be scaled up and grown with your company, RoR is a great choice. Like any web framework including RoR scaling up is pretty much identical; first phase is to optimise the code as much as possible and then you scale up horizontally. This means adding additional application servers as needed.
Is RoR Open Source?
Yes, RoR itself is distributed with MIT license free of charge. And almost all RoR related plug-ins are freely distributed under MIT license or one of Open source software licenses making it a perfect choice if you are concerned about licensing and subscription costs.
Author: DN - OCS Consultant - Ruby on Rails Developer
Sources and Web Links:
http://www.ibm.com/developerworks/java/library/j-cb05096.html?S_TACT=105AGX02&S_CMP=EDU;
http://www.buildingwebapps.com/articles/6419-can-rails-scale-absolutely
http://rails100.pbwiki.com/Alexa+Rankings
http://www.guardian.co.uk/technology/2007/dec/13/opensource.software
http://highscalability.com/friends-sale-architecture-300-million-page-view-month-facebook-ror-app
http://blog.outside.in/2008/01/22/outsidein-switches-to-rails/
http://www.loudthinking.com/posts/29-the-rails-myths
http://www.railsenvy.com/2007/3/22/ruby-on-rails-video-presentation
http://www.cio.com/article/125851/Why_Ruby_on_Rails_Succeeded
http://highscalability.com/scaling-twitter-making-twitter-10000-percent-faster
http://www.softiesonrails.com/2007/3/28/rest-101-part-1-understanding-resources