Sinatra Vs Ruby on Rails

After working as a Sinatra developer and Ruby on Rails developer for some time it has become clear that although based on some of the same foundations (Ruby and Rack) they are very different frameworks, and have very different uses. Sometimes it is hard to choose between the frameworks when the application is on the borderline of the two, but generally the complexity and size of the application will depict the framework needed.

When building a new web site, web app or api the tools and framework used is very important. Whatever you're building Sinatra or Ruby on Rails would work, but so would Drupal, Wordpress or Django. Although each of the are suited to different web applications.

Sinatra

At well under 2,000 lines of code Sinatra is a small, light and fast. Though this comes at a price, there is little MVC, no ORM database wrapper and no scaffolding. Routes and controllers are kinda merged, but Sinatra does have many options for Views. This all makes Sinatra a great choice for small apps and APIs. There is often a point where applications outgrow Sinatra and need to be ported to something else, because of the Ruby base, the obvious choice is Rails.

Ruby on Rails

At (an ever growing) close to 100,000 lines of code Ruby on Rails is a monster compared to Sinatra. There is so much bundled with it to make it a full stack framework. It manages the database and updates to it, test driven development, sending of emails, caching and sweeping of cache, full scaffolding and a whole lot more. CSS can be written in SASS and Javascript with Coffeescript, all this bundled with the Rails asset system. The list of things that make Ruby on Rails awesome can reach almost as many lines as the code itself. Although if your application is just to serve a single web page and fetch signups for a beta test, then it's overkill. If all you need is an API for your existing application, then you're looking at the wrong tool.

Summary

To conclude, if you are new to the world of Ruby, please try Sinatra before Ruby on Rails, it's a great starting block, but don't try to build the next big web sensation with it, that's what Ruby on Rails is for. If all you need is a simple web app (and want to use Ruby), then look towards Sinatra, it's a great tool for the job.

If you're looking for a developer to help out with your Sinatra or Ruby on Rails application please get in touch

Published on: 29 March 2013
By
Tags: rb, ruby, sinatra, ruby on rails,

Simple SEO PDF guide

Get our latest PDF guide, Simple SEO.

Twitter