The Guide to Cuba, a Ruby Micro Framework
theguidetocuba.io
theguidetocuba.io
I now use Sinatra only if I'm absolutely sure that the project is not going to need anything more than a single page of code. I've re-implemented Rails functionality, poorly, way too many times.
Cuba looks much leaner and meaner than even Sinatra. Can't see many use cases for it, maybe if I were implementing a non-standard API for, say, a game engine. But who wants to use Ruby for a game? Pure HTTP applications, I can definitely see the appeal. But the second you need to serve HTML, you're gonna want Rails.
I would rather say: Know your toolset and the plugins/libraries that work well with your micro-framework. Use them when applicable.
What makes Ruby great is that everything is very modular. You don't have to use the Active Record ORM if you don't want to. When I'm using Rails, I use Active Record as its Rails integration is best, but when I'm outside of Rails, I use the Sequel DB toolkit, which is far and away the nicest piece of DB abstraction software I've ever had the pleasure of working with. You could use Sequel in Rails if you wanted to, there are other ORMs as well catering to NoSQL DBs. You could even use a graph DB like Neo4j, plugs right into Rails.
I don't use Python so I would be ill-equipped to compare SQLAlchemy with Ruby Sequel. But Active Record is really nice too, it's got a lot of baked-in functionality that Just Works. Its brilliance is that most of the time, you never even notice it. But once you look under the hood, you see just how much work has gone into it. But it doesn't play well outside of Rails and isn't quite as semantically nice as Sequel.
It's been a looooong time since I last touched Rails, but I never really missed it when using Sinatra, mainly because of plugins/gems... I even wrote a few. (Currently I'm mostly using Go and C#, though).
Honest question, just so I know what I'm missing: what kind of functionality did you have to reimplement yourself?
Rails takes everything involved in web applications, breaks it apart, and figures out how to best implement it, then writes a nice guide to help you navigate the convention. If you learn how Rails does it, you're pretty much learning how to 'best' do it. So you can, for sure, re-implement it in Sinatra, but why? Rails already has a one-liner that will do exactly what you wanted it to do.
Generators is another big win. Once you learn how that system works, and granted, right now it's really hairy and not nice at all, but when you wrap your head around it, you can really turbocharge your webdev workflow, giving you Lisp-like superpowers without having to suffer the pain of debugging your own tools.
The sheer amount of knowledge embedded into StackOverflow is another huge plus. Something not working? Chances are someone has figured it out, and has documented it on SO.
I take pragmatism very seriously as a coder. I don't want to spend hours trying to figure out weird little things. I've got better things I could be doing. Rails gives me superpowers I never even knew I needed. If you've used Sinatra to build anything more complex than a dead-simple API, which is the only thing I would use it for these days, then you've probably worked hard to implement something Rails has already figured out and turned into a one-liner.
I get this spidey-sense when I'm developing in Rails, I'll be like, "surely somebody has done this already" and I'll search around on Google. Sure enough, most times I find the exact code I needed. Rails is the Rome of webdev. All roads lead to it. Just swallow your pride and use it, and you'll have the might of its legions at your back.
Eh, Too much politics in the news lately....