Re: Attempt to de-mystify AJAX
- From: Luke Webber <luke@xxxxxxxxxxxxx>
- Date: Sat, 05 Nov 2005 08:37:00 +1100
dawn wrote:
Luke Webber wrote:
Not a PHP man myself, but I'm with you on minimising Javascript and maximising the server side.
Because there are things you simply cannot possibly do that many developers will want to do in a browser interface today or very soon, there is very little choice but to use javascript. Once you bite that bullet, you just might be better off reducing the server-side scripting complexity or you could end up with the worst of both worlds.
It's the nature of Javascript that repels me, and you're never going to persuade me otherwise. I choose to minimise the Javascript because Javascript lacks all the advantages of true, compiled languages. No OO, no rigour, no discipline. These have been hard-won benefits for me after the laissez-faire days of MV BASIC, and I won't relinquish them to build houses of cards, just because people now think that everything has to be done client-side in the browser. It's a fad, and it too shall pass.
Now somebody is going to interpret that to mean that I've predicted the demise of the Web, but all I'm really saying is that AJAX is a lousy way of doing things, and /that/ is a fad. If you really need that much client-side control, you should be considering a thick client. There are mechanisms available today to keep a thick client up to date via HTTP, without all of the installation and upgrade headaches we've all come to know and hate. Java WebStart springs to mind.
Well yeah, it probably does, given the cost of round-tripping. More to the point, the real advantage of Ajax is that it doesn't do a full page refresh, and I guess that's significant for some applications. But I prefer to skirt around the issue by using frame sets.
OK. That still works. I only watched from the side with the hidden frame approach and would prefer to not have to work with frames.
But frames have all sorts of advantages. You don't want to go reloading boilerplate stuff like menus, page headers, logos and other artwork when you can just stuff them in a frame and keep them there! I generally go for a side frame with the menus, a top frame with the page banner (if needed), and a central frame where the real work takes place. Then, if the user wants to get a designer involved, I can tell them "You can play with THIS frame or THIS frame, but hands off the big one in the middle, because that's MINE". <g>
And because the central frame just has real working data in it, it's relatively fast to reload.
Somebody in this thread said something about frames acting differntly in different browsers, but I've never seen that problem, and I'm a full-time Firefox user these days. IE only gets used for testing.
Javascript can work fairly well, but if you're writing it by hand, productivity is likely to be pretty low. Generated Javascript can do the job handily as well,
If the code that is going to run is javascript, I would much rather code it directly than have it generated in a non-round-trip fashion.
Among Javascript's many other shortcomings, it's near-impossible to reliably debug. If it wasn't for the vast amounts of memory in modern PCs, I bet that half the pages out there would be falling over with memory leaks and other problems. Can't debug it, can't profile it, can't do /anything/ with it. And the more Javascript you have, the harder it is to guarantee cross-browser support.
The reason I mentioned generated Javascript is that at least you might have a chance of putting together something that doesn't have built-in bugs. Something like the way that ASP.NET does its (black) magic.
but I have trouble learning to love it.
me too, but I'm getting there. I'm starting to like it more now that I figured out (without reading this anywhere -- it was driving me nuts!) that every object in JavaScript is an associative array (an array of name-value pairs, where the values can be functions or properties). Maybe it is stretching it, but you can then think of each javascript object as a pick record/item with associated dictionary.
Surprisingly, that makes me like it /less/. <g>
So, if you haven't mastered OOP yet, it gets you some of the way there with a weakly typed procedural yet object-oriented-ish language.
Um, no. Not really. No, not at all. ;^)
Then you need to learn the DOM, of course, which doesn't take too much. http://www.w3schools.com/js/ was helpful. --dawn
It takes too much alright. The DOM is as ugly as aa hatful of monkeys' bums. OTOH, I find this very useful in dealing with it...
http://www.oreilly.com/catalog/dhtmlref2/index.html
Cheers, Luke .
- Follow-Ups:
- Re: Attempt to de-mystify AJAX
- From: Tom deL
- Re: Attempt to de-mystify AJAX
- From: dawn
- Re: Attempt to de-mystify AJAX
- From: murthi
- Re: Attempt to de-mystify AJAX
- Prev by Date: Re: d3/linux to hp jetdirect print server
- Next by Date: Re: Directly writing on the parallel port from D3
- Previous by thread: Re: Attempt to de-mystify AJAX
- Next by thread: Re: Attempt to de-mystify AJAX
- Index(es):
Relevant Pages
|