Developer at large, expert typist, fungineer

When to Sinatra, when to Rails

On Rails, Sinatra, and picking the right tool for the job. Pedro Belo, of Heroku fame, finds Rails is way better for pure-web apps and Sinatra is way better for pure-API apps. Most of it comes down to Rails has better tooling and Sinatra is better for scratching itches, which happens a lot more in APIs than applications. I’m not ready to pronounce this the final word, but what he’s saying lines up with much of my experience.

That said, you can get pretty far with a Rails API by segregating it from your application. That is, your app controllers inherit from ApplicationController and your API controllers inherit from ApiController. This keeps the often wildly different needs of applications and APIs nice and distinct.

4 Responses to “When to Sinatra, when to Rails”

  1. Marshall Yount

    Interesting discussion. Sadly, sufficiently complicated API projects can wind up dragging in pieces of Rails module by module.

    Kind of reminds me of this quote: “Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.”

  2. Adam Keys

    I see what you’re saying, but I’d love to know more. Which modules? Is it unavoidable, or as a shortcut?

Comments are closed.

Follow

Get every new post delivered to your Inbox.

Join 2,590 other followers

%d bloggers like this: