Ruby web frameworks overview: any to compete with Ruby on Rails?
Posted July 25, 2013on:
Ruby is a dynamic programming language that gains popularity year by year due to its simple syntax and effectiveness. There are many web frameworks written in Ruby. I’m pretty sure everybody heard of Ruby on Rails, but are there any other Ruby frameworks deserving attention and offering better options than Ruby on Rails does? With the success of Ruby on Rails, is there a place left for other web frameworks written in Ruby?
Most Ruby developers are working with Ruby on Rails for building web applications. However, there are some great alternative frameworks out there that also deserve a look. Some of these frameworks borrow heavily from Ruby’s premier web framework. Many offer significant improvements in speed and flexibility. Some can be used as outright replacements for Ruby on Rails. Others are perfect for running as supplemental services, when something faster and closer to the metal is needed. And a few have entirely different goals in mind, such as providing a whole web application stack in a single file for easily deployed mini-applications. But despite all their differences each of these frameworks has at least two things in common: a great dynamically-typed human-friendly base language-Ruby-and a smart, enthusiastic core group of contributors.
Here is an overview of some Ruby web frameworks which deserve a look. Let’s see how they are similar to/different from its most popular representative-Ruby on Rails.
1. Ruby on Rails
As it was already mentioned, Ruby on Rails (sometimes known as “RoR” or just “Rails”) is perhaps the most popular Ruby framework that is in use today, and with good reason. Ruby on Rails was the framework that popularized the MVC approach. This is done primarily by the Ruby on Rails MVC framework that consists of the Model (ActiveRecord), View (ActionView) and Controller (ActionController) sub-systems. It is open source and comes with a rich set of features including: AJAX support; a host of testing, security, caching and form-validation frameworks; internalization and localization functionality; and there are also pretty standard features such as DB migration frameworks, MVC Push capability, etc. Ruby on Rails emphasizes agile development, “Convention over Configuration” – developer only needs to concentrate on the non-conventional aspects of application development, and “Don’t Repeat Yourself” – information is located in a single, unambiguous place. Since it has been around for a while, there is a well-defined API, extensive documentation as well as tutorials all over the web and finally a vibrant and supportive community. The principle difference between Ruby on Rails and other frameworks for development lies in the speed and ease of use, so developers working within the environment really enjoy it. Changes made to applications are immediately applied, avoiding the time consuming steps normally associated with web development cycle.
At less than 4kb code size, Camping is one of the lightest Ruby frameworks around. In fact, it is one of the developers’ stated goals to always keep it below 4kb code size. It once again follows the MVC philosophy and provides a single file in which to carry out the development of the entire application , although the separation between each sub-system is still maintained. The developers also suggest that once initial or prototype development is completed in Camping, the project can easily be migrated to Ruby on Rails. So in some cases Camping is a precursory development environment for Ruby on Rails.
Camping does not have AJAX support, internalization and localization frameworks, nor security, caching and form-validation frameworks, but has pretty much other necessary functionality such as DB migration, Testing frameworks, ORM, etc.
Nitro is actually a framework that was around before Ruby on Rails became popular. There are a number of web developers who still swear by it. One of its finest features is a powerful template system that has a pipeline of configurable transformation steps. It is open source and along with the template style programming, there is the option of using the MVC approach as well.
Ramaze is a very simple and straight-forward web-framework. Its emphasis is on simplicity. Ramaze also has a strict adherence to modular design and having minimal dependencies between different modules. Ramaze comes with a templating system called Ezamar and also has a fairly full-featured support for MVC applications.
Sinatra is a Ruby framework which like Camping is perhaps more suited for prototype development than actual business applications. It does, however, have a pretty standard set of features including MVC support, DB migration, Template and Caching frameworks. It does not have AJAX support, nor security and form-validation frameworks. A recent entry into the Ruby web framework space, Sinatra is designed as a minimalist RESTful framework that sits on top of Mongrel. It’s core is a simple domain specific language for defining RESTful actions and responses. Also ideal for single-file mini-applications; ORM agnostic and built on Rack.
Halcyon is another lightweight framework built on Rack for speed and light weight. It aims to provide a framework for developing service-oriented applications (SOAs) such as APIs or other non-interfaced services. It has AJAX support through the JSON interface, and overall is a very well documented project and has a strong support community.
Waves seeks to provide an alternative solution for applications that do not need an MVC architecture. Thus, it has support for such things as AJAX, Adobe Air, mashups, OpenID, rich-client mobile apps, etc. This is done through a rich DSL. Waves’ developer speaks of the concept of request lambdas which are basically request mapping into a certain block, which results in a certain level of flexibility by removing some of the responsibilities of the Controller and placing the emphasis more on mappings. However, note that this is a subtle or implicit modification to the MVC pattern, and so it’s better to use it only after you have a good grasp of what’s going on and are confident that this is exactly what you need.
As you can see there are a large number of frameworks for writing Ruby web applications instead of using Rails. Rails is absolutely a great framework but it’s always good to have other tools at our disposal, isn’t it? Maybe some smaller job or certain features of any of these frameworks would be better suited to the task. Having this variety of web frameworks is healthy for the Ruby community as it not only gives developers options but also allows for exploration of innovative ideas that may not be implemented with Rails. Check one of them out if you have the opportunity – I’m sure you won’t regret this. Please note that the list of Ruby frameworks in my article wasn’t intended to be exhaustive. If I am missing some frameworks, please let me know and I will incorporate them into future posts. As always, eager to see your comments🙂