Hacker News new | past | comments | ask | show | jobs | submit login

Our product is built on Rails, but I do almost all my development in Sinatra now. The biggest win for me is that Sinatra strips away everything that would allow you to procrastinate in Rails (such as figuring out whether your actions are RESTful enough, or making sure you're serving all the content types, or making sure you've balanced code properly between controllers and models).

There is nothing to do in Sinatra except to get to work on your application, which is a good thing.

I highly recommend Datamapper over ActiveRecord, too; between Sinatra and Datamapper, you can literally pop open a single file and have a complete working application when you exit the editor, with no external setup steps.




"There is nothing to do in Sinatra except to get to work on your application, which is a good thing."

What does Sinatra use for layouts and views and partials by default? Last I looked it appeared to be .... nothing.

It seems then that for anything non-trivial you're either inventing a view system or tacking one on. Am I missing something about this?

Among the things I like about Ramaze is that, like Sinatra, I can do the all-in-one-file web app if I like, but if I decide to refactor to layouts and views and such there's an obvious, ready path. Ramaze lets me evolve smoothly from dead-simple to high sophistication, and I don't see that with Sinatra.


You can use whatever view-building libary you wish with Sinatra. Last I looked, Sinatra had convenience functions for using Erb and Haml, but there nothing stopping you from using something less well known, such as Tagz.


I use Haml and Sass. I had to "roll my own" partials --- which is to say, I wrote a 1 line convenience function to set "layout => false" on the call to haml().

By default, Sinatra will read views out of the views/ directory, but I try to keep things in the files, so each area of functionality in the app is self contained.


Sinatra has built in handlers to render erb, haml, builder, and sass. Layouts are handled by automatically grabbing the file layout.erb (or layout.haml, etc). Partials are a bit of a pain, since you have to write your own helper, but at it's core, you're just calling the same erb helper, but with :layout => false.

It's downright trivial to add your own rendering helper for any templating language.

And for organization purposes, it's really freeform. Act like you're writing any other ruby app, and organize how you like. If it's small, a single file makes sense, if it's medium sized, maybe a file for controller and one for models, for big, do the split into an app/{routes,models,views}. All of that is easily supported.

Check out Monk as a good example of how Sinatra can be adapted to a more complex directory structure.

(also, Hi James!).


Another thing I love about Sinatra is that instead of controller/model/view files, I can do users/posts/comments, with one file for each functional area.


Interesting.

So far I see nothing that makes Sinatra more appealing or useful than Ramaze, and some thing that make it less so.

The curious thing is that on the one hand Sinatra gets described as a "framework", and on other other hand there's a great deal of BYOC (bring your own code).

That's fine, and something I tedn to prefer, but if I really want lightweight microstuff I'd start with a plain Rack app, and if I need more I'd convert it into a Ramaze app.

I do like how Sinatra auto-maps the REST verbs, but basically it comes off more as Rack middleware with a cheering section than an actual Web framework, micro or otherwise.

(also, Hey Chris!)


I have no horse in this race, I'm just using and liking Sinatra as a "sandbox framework" to go along with our Rails deployment. So, with that said:

Sell me on Ramaze. I love that I can whip out a 2-file application in Sinatra --- one file for the Ruby and templates, and another for the jQ js that'll run on the client. What does Ramaze do better than Sinatra for me?


". I love that I can whip out a 2-file application in Sinatra --- one file for the Ruby and templates, and another for the jQ js that'll run on the client."

Yeah, I love that about Ramaze as well. :)

"What does Ramaze do better than Sinatra for me?"

Appears to be faster (at least in some simple benchmarks I ran). Choice of templating language may be key.

Has a better-sized set of robust standard helpers, should you want to load them.

More built-in adapters for a wide variety of template engines (Haml, Ezamar, Liquid, Markaby, others)

Unbeatable community on irc (#ramaze on freenode)

Way cooler shirts and coffee cups: http://www.cafepress.com/rubystuff/4904578 ;)

Whether or not any of this works out as "better" for anyone is hard to say. I like that Sinatra doesn't dump a ton of must-load crap on you just to get started, but neither does rolling a plain Rack app. Or Ramaze, for that matter.

It's also nice to have a reliable set of built-in libs to pull from, and as best I can see there's a stronger choice in Ramaze.

But, to be honest, Sinatra just never showed enough value to me to dig into all it's possibilities, so I may be wrong in my observations.


Thanks. Helpful! Appreciated.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: