Roda – A new Ruby web framework
roda.jeremyevans.net
roda.jeremyevans.net
There are certainly parts of Sequel that are overly clever, I won't argue that. But compared to similar libraries, I don't think it's worse in that department.
Nice to see new ideas around web frameworks. Kudos!
Thanks for the inspiration!
It's not cleaned up yet, but here is the link: https://github.com/mahmoudimus/pyramid_maze
I've converted about 15 apps from Sinatra to Roda, and a couple of Rails apps to Roda (working on converting my final Rails app). Personally, I've found that the biggest advantages come when the URL structure mirrors your application structure, and you have redundant code in many routes, as that type of code becomes simpler, faster, and DRYer with Roda.
Yes, you can use a before block with wildcard routes with Sinatra, but Sinatra will still traverse the routing list sequentially and recheck the full route for every entry in the list. Unfortunately, while I love Sinatra, have contributed patches to it, and have used it since 0.1.0, the approach doesn't scale well for sites with a lot of routes.
The code non-locality issue shouldn't be ignored, and is probably the largest issue with Roda, but the issue is probably going to happen with any approach that DRYs up the code to the same degree. It's true if you use a before block in Sinatra, or a before_filter in Rails.
The use of a routing tree really isn't an innovative approach (at least not innovated by me). It's been around in Ruby since Rum was released in 2008 (and maybe earlier elsewhere). However, it's not well known, and I hope that Roda brings it into the mainstream.
One of the best things about Roda that I don't think has been mentioned in the comments yet is the plugin system, which I borrowed from Sequel. This makes it easy to extend Roda beyond its very small core. For example, the multi_route plugin makes it easy to scale Roda to larger sites by splitting up routing subtrees into specific files. There are currently about 15 plugins, and I have ideas for quite a few more that I will implement after finishing up my current Rails->Roda conversion.
I apologize that the code on the website isn't syntax highlighted. If anyone can offer their design skills, I would greatly appreciate it.
If you have any questions about Roda, please ask.
Second: How well does it scale for developing large sites (for whatever value of "large" seems useful for discussion).
One of the things I really like about Ramaze is that I can start with basically a Rack app, spin it off to a simple Ramaze app, and keep expanding and refactoring it as requirements call for.
Is there some app size or level of app complexity beyond which Roda would not be a sensible choice? You say it has a plugin system; is it really battle-ready? (I'm going to guess Yes because of who wrote it, but I'd like to hear any additional thoughts on it.)
I get the impression that Roda lends itself to building large sites that are a collection of sub-sites or services; you're never really building a single big monolithic app.
Side note: For fast syntax highlighting you could use embedded gists.
Your workflow with Rack->Ramaze should work similarly when using Roda. Roda scales down well:
# config.ru
require 'roda'
Roda.route{'Hello world'}
run Roda
There is probably some level of complexity where Roda may not be a good choice. I'm not sure what that level is, but I don't expect to hit it on sites I work on. In any case it's probably best to split up such an app into multiple apps/services before that level is reached.In terms of battle readiness, it's new and currently I think I'm the only person using it in production. I hesitate to call something battle ready until there are more people using it, but I'm very committed to it and you can expect the same level of support for Roda that Sequel receives.
Thanks for the tip on embedded gists, I'll look into that.
before '/artist/:id*' do
@artist = Artist[params[:id]]
end
before '/artist/:id/album/:number*' do
@album = @artist.album_with_number(params[:number])
endIt's not all that new. Subdispatch with anonymous functions has been done before:
https://metacpan.org/pod/Web::Simple#DISPATCH-STRATEGY
As for readability, Roda kinda shoots itself in the code by not having any highlighting on that snippet, but generally yes, you want to keep dispatch trees to small apps. On the other hand, using P/WSGI apps you can stack apps inside one another, scaling trees without getting a moloch. Not clear on whether Roda supports that.
This also lead me to check out sequel, which I can't believe that I'm just now finding out about.
https://github.com/kballenegger/kenji
One of the big things that makes Kenji awesome is that, like Roda, it uses a routing tree.
http://www.madebymarket.com/blog/dev/ruby-web-benchmark-repo...
I'm a .NET dev finally looking at Ruby again. I have a Rails book from a long while ago that I'm working through (well, planning on - Rails 4 in Action, still in MEAP) but looking at this data I'm wondering if that's the best idea.
Any recommendations on a framework for someone getting started?
If it helps, I've been using ASP.NET MVC since 1.0 if not slightly earlier.
It sounds like you may have come into Ruby from a similar background; any suggestions on a good way to start learning the language? There seems to be an interesting post on creating a very basic blog engine via Sinatra, but everything else I've found is ... lacking.
As far as my own goals, I actually like .NET (C#) as a language, and generally don't feel as though ASP.NET MVC is too complex. It has definitely gotten a bit more bloated in particular areas, but ... Shrug.
Thanks again!