-- Matthew Ratzloff <[EMAIL PROTECTED]> wrote (on Tuesday, 04 December 2007, 09:21 AM -0800): > I feel compelled to trot out my essay from last year on this subject. It > has some concepts that apply to this discussion. > > http://www.builtfromsource.com/2006/12/20/does-ajax-have-a-place-in-the-application-framework/
Thanks for trotting this out again. I was trying to come up with a good response, but that says most of it. :-) > Handling an Ajax request is just like handling any other type of request, > and Zend_Controller_Request_Http even provides an isXmlHttpRequest() > method that's compatible "out of the box" with Prototype, jQuery, and YUI. > And with one line of JavaScript you get that same functionality with Dojo > and MooTools. It's so incredibly trivial with dojo, it's not even funny; you simply specify an extra header in your request. > But pairing Zend Framework with a specific JavaScript library is a bad > idea, and frankly I'm unconvinced that projects like Xajax are a net gain. > There are so many good JavaScript-only frameworks out there > already--Prototype, jQuery, etc.--that make Ajax ridiculously simple. > Really, it was never that difficult in the first place. In trying to > "simplify" it by making the API PHP-only it will only complicate things > more. In addition to that, it means splitting the focus of ZF -- part of our attention is on PHP, the other on JS, and, quite honestly, most of us are better PHP developers than JS developers. Yes, doing AJAX even on the server side requires some knowledge of JS and how requests are made. However, I for instance am in a position where I write the backends, and a front-end developer does the UI. This means I simply need to make sure that they can make the calls they need, and return things in the formats they want. I don't need to know what JS library they're using, nor how the data I return is being used. I've looked at solutions like XAJAX, and there are a couple of things that scare me about them: JS/PHP disconnect (i.e., one or the other portion of the underlying XAJAX library grows and the other does not, meaning the interactions tend to be less than smooth), and security (do I really want the client-side to know that much about the server-side API?). Finally, as Matthew Ratzloff notes, you can typically do more and better UI stuff with an established JS library, and the UI is a lot of what AJAX in its most generic usage is about. If you're going to need to use one of these libraries already to get things to look and feel and react the way you want, why add another set of JS libraries into the mix? > On Mon, December 3, 2007 5:09 pm, Mark Maynereid wrote: > > > > Thank you for those answers Matthew. Very encouraging. I look > > forward to the proposal unification keenly. Hopefully there is a > > good appetite for nailing this one given all the great work so far, > > and the features you have listed below are certainly what I would > > hope for. Perhaps they are in order of priority too? > > > > I see you mention AJAX for client side validation, and note others > > have commented on ZF/AJAX concerns in general. I imagine trying to > > deliver a decent quality AJAX library from scratch now would be > > daunting. Yet AJAX is expected these days so perhaps third party > > libraries are inevitable here (for now). > > > > Also personally, I do not particularly enjoy having to write code twice > > (first to write server side validation in PHP, and then have to write the > > code yet again in Javascript for client side validation). Then have to > > keep > > it in sync and maintain a doubled up codebase. My JS is weak anyway. > > > > Wouldn't it be cleaner to hand off the whole AJAX thing so we can treat it > > like a black box and control it purely from PHP? Those that want to are > > then > > freed from Javascript coding entirely, and as a massive bonus, the server > > side validation code potentially becomes common to the client side > > validation code! Codebase duplication eliminated :) While trawling the > > XJAX > > libraries I came across the xajax project which appears to do precisely > > this: > > > > Here's a quick 10 minute overview: > > http://www.xajaxproject.org/docs/xajax-in-10-minutes.php > > > > I have played with xajax a little and if it is as good as it appears, I > > would love to see provision for it in ZF. My hunch is it could also prove > > the easiest and tidiest of all ZF AJAX solutions to roll out first > > precisely > > because of its apparently unique 100% PHP API. Any good? > > > > > > Regards, > > Mark > -- Matthew Weier O'Phinney PHP Developer | [EMAIL PROTECTED] Zend - The PHP Company | http://www.zend.com/
