I was recently playing with javascript when I saw this interesting concept on object instantiation:
ref: http://devedge.netscape.com/library/manuals/2000/javascript/1.5/guide/obj.html#1008330
myHonda = {color:"red",wheels:4,engine:{cylinders:4,size:2.2}};
Wow -I said to myself- this means that I can create any object I want on the fly!
What if I just get a string that represents an object transmitted over the wires instead of bloated xml?
With the 'eval' function you can convert that string into an object like this:
// assume the stream was received from an http request to a data server page
stream = "myHonda={color:'red',wheels:4,engine:{cylinders:4,size:2.2}}";
myCar = eval(stream);
text1.value = myCar.color;
text2.value = myCar.wheels;
text3.value = myCar.engine.cylinders;
see how cool it is? no more parsing trees, guessing types or clogging the wires ;-)
Then I kept wondering, how about using the xmlhttp object, available in IE and mozilla, to request data streams from web client apps?
No roundtrips to the server, no reloading pages, no repainting controls that are already there. Just data...
The holy grail of web apps !
And it has been at our fingertips all of this time!
Check this samples for more real world scenarios, and as you will see, not only data servers can produce data streams, but any resource, web or not.
Of course I went on and created the asp and php code that would convert any sql request to the server in a beautiful javascript object stream. Two functions to govern the world, getObject and setObject.
More to come...