To Rails, or To Sinatra?

With the ubiquity of frameworks designed to build web applications, it can be difficult to decide which one to go with on any given project. I’m writing this post to give some insight on how this manifests in the Ruby world. I will present this as a series of questions you should consider when deciding on the framework.

What’s Your Overall Goal?

The main differentiating factor here is if your interest is in learning web development, or just creating a one-off project. If your interest is in learning development, I suggest starting with Sinatra. Just speaking from my own experience, my understanding of how to work in Rails was greatly enhanced by learning Sinatra first. A common phrase in the Rails community is “convention over configuration.” In Sinatra, you have to be more granular and need a deeper understanding of how Ruby works. While the concept & philosophy of how the data flows doesn’t really change, Sinatra’s more imperative and Rails is more declarative. Declarative vs imperative is a concept beyond the scope of this post, but in short, declarative is “I want you to do this task,” and imperative is “these are the exact steps I want you to take in order to perform this task.”

What’s The Project Size?

This question is in regards to the number of people working on the project. Just based on its prevalence in industry, it’s more likely that developers are familiar with Rails, and I’ll let you in on a little secret…
…developers are people, too, and we generally don’t like to do tedious tasks, just like everyone else.
So if you’re starting a new project with other developers, and you all decided to use Ruby, I would say start the conversation with Rails. I have to mention that there are many variables when deciding on which tools to use in a team project, and it’s not always a this-or-that decision.

How Many People Will Use It?

This is probably the cleaner of the three questions to answer. If you’re building a pet project for your immediate friends & family (say 20 people or less), Sinatra will work just fine. Now, twenty is more of a “ballpark figure,” not a hard cut-off; if you’re planning for more users than that, you really should use Rails. Because of the way it’s designed, Rails scales better than Sinatra; as the user-base grows, it’s less problematic to manage an app built with Rails than Sinatra.

Hopefully this helps in deciding between the two, and happy coding!

Leave a Reply