Hi Peter.
Where do you get all the papers from ;) Looks interesting, I'll to
read it completely through, soon.
But... an important thing is that AJAX itself is not the revolutionary
approach it is hyped to be.
In fact the idea of sending and processing http requests
asynchronously with JavaScript is incredibly trivial.
But this tiny simple asynchronous request was what made JavaScript
socially acceptable in the browser world
(it used to be a dirty and unsecure scripting language which you
better turn off, before).
Lots of frameworks popped up offering a lot of eye candy and language
beautifiers around the asynchronous
request object and JavaScript in general and everything was wrapped in
the fancy term AJAX and well...
that's what some people call the revolution. I read a nice Article on
Ajaxian yesterday,
that "Ajax was one of the most successful rebrandings in software
history"
http://ajaxian.com/archives/javascript-rebranded-check.
Well.. in a revolution, philosophers are needed, of course,
but what finally makes a revolution are the people walking the
streets.
That is why I'm so happy about all the rapid internet application
developers in general and
Brians and Justins work in particular because they simply write code
before writing an abstract paper
(maybe some kind of philosophers walking the street ;).
I think you are at the moment very free to use the AJAX technology and
frameworks as it's most suitable for your needs (just replace some
HTML,
do some eye candy on your page, don't use ist at all or use it with
JSMVC). There aren't really established best AJAX practises yet so you
can choose freely
and you shouldn't use a framework, technology or design pattern if it
doesn't make sense to you or seems to complicated (the most important
thing in RIAD for me is to keep it as damn SIMPLE as possible).
But I think what you - like me, too - are missing on the JSMVC
documentation are examples for a server side part other than ruby.
I still want to write a tutorial about this and maybe a little
framework implementing the idea, but I don't have
time for it at the moment.
So let me just give you a very quick (and dirty ;) example (which
probably won't instantly work but I hope you get the idea):
Server side (load.php):
<?php
// Here some data in an array (may come from the database, too)
$test = array("test" => "Hello", "thing" => "World");
echo json_encode($test);
// Will print something like
// { test : Hello, thing: World }
// which can be evaluated directly as a JavaScript object
?>
JSMVC:
Controller('todos',
{
"a click" : function(params)
{
this.element = params.element;
this.element.innerHTML = 'Loading...';
new Ajax.Request('load.php', {onComplete: this.continue_to('load')}
},
load : function(response)
{
// NEVER EVER do this in production ;)
// Use something like Prototypes
response.responseText.evalJSON();
this.data = eval(response.responseText);
this.render( { to: this.element });
}
});
views/todos/load.ejs
Test: <%= data.test %> <br />
Thing: <%= data.thing %><br />
I think it is now obvious what is meant with "Thin Server
Architecture".
Just two lines of PHP code offer the data you need, everything else is
done on the client side
(that is the important thing I wanted to point out).
I'm still working on a more detailed (and working ;) example. But I
hope you get a better idea now.
Daff