What is Ruby on Rails and Why Should I Use it for Web Applications?
A few potential clients have asked 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.
It is true that it isn't always as easy to find a Rails host as it is a PHP host. This is primarily because Rails can be more resource intensive, a fact which deters low-end shared-hosting providers. However, this is by no means a dealbreaker, 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), as you will then have full control over the server and can allocate sufficient resources for your application. Any Rails developers can set this up for you. Examples of VPSs include Amazon EC2, Slicehost, and Linode.
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 directness of the language.
Agile web development is also advocated within the Rails community. This is a particular method of structuring the development process and ensuring that effective communication occurs between the developers and the client.
Potential Rails problems and limitations, and our solutions:
A key principle of Ruby on Rails development (henceforth 'Rails') is 'Convention over Configuration' (CoC). This means that the programmer only has to write new code for the areas in which their application deviates from the standard.
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 opened up as an API (Application Programming Interface).
Agile web development is also advocated within the Rails community. This is a particular method of structuring the development process and ensuring that effective communication occurs between the developers and the client.
During its short existence, Ruby on Rails has gained a large and enthusiastic following. This is largely due to the way it excels at enabling the rapid development of dynamic web applications.I will now 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 partly because of CoC, which reduces the amount of code that needs to be written.
- CoC also makes it easy for developers to move between different Rails projects, as each project will tend to follow the same structure and coding practices.
- Ruby code is very readable and therefore is self-documenting. This increases productivity, as there is no need to write out separate documentation, and it is easy for other developers to pick up projects.
- Rails was originally developed by David Heinemeier Hansson to enable him to build Basecamp with Ruby, and consequently it is suited to building large applications.
- The CoC and DRY (Don't Repeat Yourself) maxims and Agile methodologies all aim to make the web application development process as enjoyable as possible.
Potential Rails problems and limitations, and our solutions:
- Not all website hosts can support Rails.
It is true that it isn't always as easy to find a Rails host as it is a PHP host. This is primarily because Rails can be more resource intensive, a fact which deters low-end shared-hosting providers. However, this is by no means a dealbreaker, 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), as you will then have full control over the server and can allocate sufficient resources for your application. Any Rails developers can set this up for you. Examples of VPSs include Amazon EC2, Slicehost, and Linode.
- Long term survivability: it has only been around for 4 years and is not as established as Java or PHP. Will it stand the test of time?
Although Rails is still relatively new, it is giving every indication of being able to grow and prosper. Now the Ruby Revolution is over and the dust has settled, both Ruby and Rails have demonstrated their staying power by continuing to attract new users. The Rails community is constantly expanding and maturing, and there are now over a million Ruby developers worldwide.Furthermore, the appearance of new books on Ruby on Rails and the increasing numbers of Ruby on Rails apps in production are all evidence that Ruby on Rails is well on its way to becoming firmly established.
- Scalability in terms of the number of users (not functionality)
There have been concerns that Rails applications are not as fast as Java or C, but this is really only a problem for sites which are accessed by millions of users simultaneously, but even then there are ways to work around this.
Rails is only effective if you follow the conventions, and this can feel restrictive to some. When followed, the conventions facilitate greater productivity and ease of work, so at this point developers who attempt to force it to work like other frameworks will inevitably find it unsatisfactory. This is more a matter of incompatibility between the programmer and the software than of any inadequacy of the software. This is not to say that developers can't break away from the conventions, but this would mean that they wouldn't receive any of the added benefits which accompany the conventions.
- Conventions
Rails is only effective if you follow the conventions, and this can feel restrictive to some. When followed, the conventions facilitate greater productivity and ease of work, so at this point developers who attempt to force it to work like other frameworks will inevitably find it unsatisfactory. This is more a matter of incompatibility between the programmer and the software than of any inadequacy of the software. This is not to say that developers can't break away from the conventions, but this would mean that they wouldn't receive any of the added benefits which accompany the conventions.
In conclusion...
Our decision to use Rails is above all one of personal preference. Rails does not suit every developer or project, but we choose to use it because it works well for us and suits the dynamic web applications that we build.You can read more about the benefits of Ruby on Rails in this article on the rise of Ruby.Bit Zesty - Ruby on Rails Development, UK