Some clients ask us why we choose to use Ruby on Rails to develop web applications instead of all the other web frameworks and languages. There are many reasons for our decision, but before I embark on a discussion of the advantages (and disadvantages) of Ruby on Rails, I should first explain what Ruby on Rails actually is.
Ruby on Rails
Rails is a development tool which gives web developers a framework, providing structure for all the code they write. The Rails framework helps developers to build websites and applications, because it abstracts and simplifies common repetitive tasks.
Rails is written in Ruby, the programming language which is also used alongside Rails. Ruby is to Rails as PHP is to Symfony and Zend, or as Python is to Django. The appeal of Ruby to developers lies in the elegance and terseness of the language.
One of key principles of Ruby on Rails development (henceforth ‘Rails’) is convention over configuration. This means that the programmer does not have to spend a lot of time configuring files in order to get setup, Rails comes with a set of conventions which help speed up development.
Another characteristic of Rails is the emphasis on RESTful application design. REST (Representational State Transfer) is a style of software architecture based around the client-server relationship. It encourages a logical structure within applications, which means they can easily be exposed as an API (Application Programming Interface).
From project management point of view, the Ruby on Rails community advocate Agile web development – an iterative development method, that encourages collaborative and flexible approach, which is particularly well suited for web application development with fast changing requirements.
Over the last few years Ruby on Rails has gained a large and enthusiastic following, but lets consider the main arguments for and against Rails.
Pros and Cons of Rails
Why we prefer to use Ruby on Rails:
- The process of programming is much faster than with other frameworks and languages, partly because of the object-oriented nature of Ruby and the vast collection of open source code available within the Rails community.
- The Rails conventions also make it easy for developers to move between different Rails projects, as each project will tend to follow the same structure and coding practices.
- Rails is good for rapid application development (RAD), as the framework makes it easy to accommodate changes.
- Ruby code is very readable and mostly self-documenting. This increases productivity, as there is less need to write out separate documentation, making it easier for other developers to pick up existing projects.
- Rails has developed a strong focus on testing, and has good testing frameworks.
- Rails and most of its libraries are open source, so unlike other commercial development frameworks there are no licensing costs involved.
Potential Rails problems and limitations and how to overcome them:
- Not all website hosts can support Rails
While it is true that not all web hosts support Rails, this is primarily because it can be more resource intensive than PHP, a fact which deters low-end shared-hosting providers. However, this is by no means a deal-breaker, and of course Rails-friendly hosts do exist, for example, Heroku and EngineYard.
Alternatively, you can host your Rails application on a Virtual Private Server (VPS) with Amazon EC2, Rackspace, or Linode. You will then have full control over the server and can allocate sufficient resources for your application.
- Java and PHP are more widely used, and there are more developers in these languages
The number of Ruby developers is growing year on year as more people switch to it from other programming languages. One of the main differences between the Ruby and other communities is the amount of open source code (gems) which is publicly available, as of writing there are 63,711 gems which you can use to enhance your application.
- Performance and Scalability
There have been concerns that Rails applications are not as fast as Java or C, which is true, but for the majority of applications it is fast enough. There are plenty of high profile organisations which rely on Rails to power their sites including AirBnB, Yellow Pages, Groupon, Channel 5, and Gov.uk.
There is also the option of running your application under JRuby, so you have the same performance characteristics as Java.
Our decision to use Rails is above all one of personal preference – we find that it works well for us by enabling the rapid development of dynamic web applications.