My boss has an idea which is rather interesting though I'm concerned about the implications. Essentially, he wants to be able to execute multiple actions with a single HTTP request via a mechanism similar to piping in UNIX.
Imagine a URL path like this:
/rest/customer/search*f_name/bob*save
The basic ideas is this:
While I think this idea is rather interesting, I have some reservations. First, this is a GET request altering state on the server. Changing it to POST is trivial, so we'll ignore that.
My main concern is ensuring that unexpected behavior doesn't crop up. For example, if the third step of a four step pipe fails, what should be the behavior? Roll back and just give a nice error message? If so, I'll have to ensure that this behavior finds a way to "mark" anything with irreversible side-effects or simply identify and disallow them. And whatever gets used as the pipe character will need to be correctly escaped for all non-piping instances of it.
In any event, while I see the potential utility, the idea of mapping multiple actions to a single request via HTTP seems a bit odd and I'm curious to know if anyone has tried anything like this and if they can discuss the pros and cons. (Heck, discuss 'em even if you haven't tried this). I'd hate to get partway through implementing this only to slap my forehead and realize I missed something obvious.
Re:not really a pipe is it?
Theory on 2005-11-29T14:47:04
So, they aren't really pipes. Right? More like for (search) {$_->f_name=bob; $_->save;} or something? I suppose you could just insist that the last step be the only state-changing action?You're right, it's not like Unix pipes. It's more like chaining method calls:
map { $_->f_name('Bob')->save } search();
—Theory