Hello,
How about a common basic framework, that includes all this stuff? Of course this might not work for all frameworks, but at least Iowa, SWS, CGIkit (and Borges?) should have some common pieces of code.
I what we need is just an upgrade of CGI.rb. There was a post about this a long time back at ruby-talk:21315. Rails would definitely like to use something like that.
Narf is an upgrade of CGI.rb. I rebuilt CGI.rb, using Wakou's tests and adding tests for everything else. I felt that the maintainer of an IO libraries should support testing itself, so Narf expanded a bit.
For example, Tom Clarke added a templating library to support testing. The idea was that writing webapps is easier if you write asserts on the variables passed to the template, instead of writing asserts on the HTML.
The good thing about Narf is that not too many folks use it. So it can still be a bit of a playground for the moment. I'm open to suggestions.
To be honest, I think the api of Narf is pretty good. This stuff isn't all that complicated. I think the main thing is supporting multiple backends, so that's what I'm going to focus on.
Cheers,
Patrick
P.S. <rant> About the only cgi design suggestion I see on ruby-talk that I outright disagree with is Request / Response.
I experimented with this in Narf, and I think it is a mistake. You end up with two objects, with alot of shared implementation code, that always go together, split apart for no practical reason. I don't mind having Request / Response separated in the documentation, but splitting it in the code just adds typing. When will you ever want a request without the response? Martin Fowler has a name for this refactoring, but I don't have his book.
The Java Servlet API is not one to imitate. It's a design which solved the problem that Java was too slow to run as a CGI. Given that ruby doesn't have that limitation, I'd rather design the API that makes building web apps easy and fun.
Why bother with the API that made it possible to run web apps on a bloated os / programming language / platform / all around lemon? </rant>
···
On Friday, August 20, 2004, at 01:36 PM, David Heinemeier Hansson wrote: