Evan Light recently used the wonderful phrase ”Use Rails Until It Hurts”. He meant that Rails has built-in mechanisms for organizing your code and objects, and they usually result in simpler, cleaner code that mixing Rails with non-Rails.
I say your startup should use Rails until it hurts. And it hurts most to use it for APIs. Let me tell you what I mean.
Rails and Less Rails
I work at Ooyala, an awesome mid-sized startup. Like many startups, we started on Rails and we’re using less and less Rails as we go along. We’re switching mostly to Sinatra and other Ruby frameworks, for the record.
Rails is designed for defaults. Rails is amazing for your tiny startup that’s just testing out an idea. And Rails’ wonderful ways to protect you from yourself will take you a surprisingly long way without making you think too hard about security. That’s great… up to a point.
But we all know that vanilla Rails isn’t so good for APIs. A big company’s internal code is pretty much a giant ball of APIs. And internal code is 95% of what we do. Even companies who clearly love Rails stop using it for back-end APIs pretty quickly. And that’s even better.
Wait, Switch? To What?
Why? What’s better for APIs? Well, Sinatra, pretty obviously. Rails-API, when it’s finally stable. And in fact, there’s a burgeoning cottage industry of API frameworks just in Ruby, including Grape and RocketPants.
For that matter, you can build on plain vanilla Rack – if you do, consider buying my book since it’s the best documentation on how to build a low-level Rack framework.
But Then, Is Rails Doomed?
I keep saying “Rails is awesome” in kind of back-handed ways. So let me say, for the record: I think Rails is great, I think it’s still growing, and I think it’s not going away. I think that even more frameworks are going to steal its best ideas. I think it’s going to take a long time to be replaced, and whatever finally kills it doesn’t exist yet.
I think it’s going to become clearer that Rails is a niche framework for a very specific set of needs. And I think it’s by far the best thing out there for that niche and those needs. And I think we’re going to see a lot more “growing out of Rails” stories and a lot more “growing out of Rails” frameworks as we see “Rails” and “post-Rails” as two different viable niches.
Comments