Hacker News new | ask | show | jobs
by glassx 3884 days ago
> I've re-implemented Rails functionality, poorly, way too many times.

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?

1 comments

The biggest thing I missed was separation between routes and controllers. In Sinatra they're combined, it takes a lot of hackery to implement Rails-style routes. But you're gonna need them more and more as your web app increases in complexity.

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.