Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×
Programming Java The Internet IT Technology

Better Web Apps With Ajax 184

An anonymous reader wrote to mention an article on IBM's site detailing the fundamentals of Java-based Ajax. From the article: "This article gives you a good understanding of the fundamental principles of Ajax, and a nuts-and-bolts knowledge of the client and server side components that participate in an Ajax interaction. These are the building blocks of a Java-based Ajax Web application. In addition, you will be shown some of the high-level design issues that come with the Ajax approach."
This discussion has been archived. No new comments can be posted.

Better Web Apps With Ajax

Comments Filter:
  • Two camps (Score:4, Insightful)

    by sexyrexy ( 793497 ) on Thursday September 22, 2005 @07:04PM (#13625741)
    I'm glad to see another serious technical article on the pros and cons of implementing an AJAX solution. Most everyone who says the acronym "AJAX" usually falls into one of two camps - either the "OMFGZ teh AJAX is so amazing! It will change the interweb!" How? Oh, it allows parts of the page to be updated without a refresh. How interesting. Perhaps you could go a little more in-depth? No? Thanks...

    The other camp... too many Slashdotters, IMO... feel the need to flex their superior understanding of the fundamental dynamics of the internet and development and offer this gem: "AJAX is just an assortment of pre-existing technologies. Nothing to see here".

    The automobile was just an assortment of pre-existing technologies, and it radically changed the world. It also introduced a whole bevy of new challenges, both technical and otherwise, that we still haven't fully figured out yet. It was not a transportation panacea, and AJAX is no cure-all. But just because it doesn't solve every problem doesn't mean it doesn't have the power to be revolutionary.
  • by daviddennis ( 10926 ) <david@amazing.com> on Thursday September 22, 2005 @07:18PM (#13625818) Homepage
    Okay, let me try to understand this. I'm putting together a brand spanking new web application that would greatly benefit from this technology. But to me, simplicity is the cardinal rule. Why do something in 50 steps, translating data from one langugage to another, when you can just keep it in one?

    I have over a decade of experience writing programs that spit out HTML. Why not have my Perl scripts spit out garden variety HTML which can then be substituted appropriately on the page?

    It seems to me that would be simple, clean and functional. And it might be a simple matter of saying my content type is text/html instead of application/xml.

    Why put the burden on JavaScript on the client, when I already know how to do it on the server? In terms of server processor time, it's just as easy to spit out HTML directly than it is to spit out XML and translate it to HTML on the other side.

    And if it is easy to do this, I'd appreciate a link to a tutorial.

    Many thanks for your time and ideas.

    D
  • by spid ( 41738 ) on Thursday September 22, 2005 @07:44PM (#13625974)
    Not so. In both IE and Mozilla XML parsing is done in native code, and is pretty darn fast. Granted, accessing the nodes in that resultant document can be tedious from a development standpoint, but if it's performance you care about, then XML will most certainly be faster. While JSON may be more terse, and easier to deal with as a developer, the browser still ends up having to create a lot of objects in interpreted code, which is a lot slower.
  • by Anonymous Coward on Thursday September 22, 2005 @08:01PM (#13626063)
    <html>
    <head>
    <title>Ajax app</title>
    <script type="javascript" src="ajax.js">
    </head>
    <body onload="ajaxInit()">
    <noscript>
    We are very sorry but we, the developers of this website don't understand the web. We would like to provide a non-script alternative for the visually impaired, disabled and people with security smarts but "Ajax" is the future of the interweb and you are not. If you do happen to be visually impaired, disabled or security conscious then fuck off because we are too busy fapping to the latest buzzword to give a shit about you.
    </noscript>
    </body>
    </html>
  • by Anonymous Coward on Thursday September 22, 2005 @08:13PM (#13626131)

    XML is longer and hard for a javascript interpreter to interpret. Why does everyone want to use it as a wire protocol?

    XML might be hard for a Javascript interpreter to interpret, but you don't interpret the XML with Javascript. The XML parsing routines are built into the web browser itself, you just access it with the DOM, same as with all the other Javascript you write.

    Yes, that's marginally harder than having i as a native Javascript object, but it has the benefit of being reusable no matter what language you are using. If I also want to manipulate the data with a script, I can write that in any language, using standard XML APIs, not just one that can interpret Javascript.

    Given that the difference in effort between the two is so minimal, I prefer to use the more flexible approach.

  • by uptoeleven ( 845032 ) on Thursday September 22, 2005 @08:22PM (#13626167) Journal
    OK I admit I have a vested interest in this. I wrote an API that did exactly this (custom strings) in IE4 & NN4. This is before IE5 came out and before I'd learned to read w3c specs properly. The API sucked more suckily than anything has ever sucked before. It was a multi-car pile-up of an API. I spent months writing this crap and nearly lost my job and those of my project manager and line manager over it. It was the code no-one else would touch, despite extensive documentation. I wrote this... thing, it used invisible frames or invisible iframes (no I didn't know what XML was supposed to do either), it was supposed to implement some sort of windowing system within a browser.

    Now picture this. A windowing system, to run in IE4 or Netscape 4 written by someone who doesn't know what they're doing. You want memory leaks? We had 'em. Most of the clients' machines would die after ten minutes running this. You want race conditions? Yup we those had those ose se e as we.
    ll
    This thing was so asynchronous it would frequently try to write to HTML elements that didn't exist yet... or that did exist but that the browser had decided they'd disappeared. Netscape 4 was the best at this. If a string was too long suddenly the rest of the dom disappeared into recursion hell and you couldn't drill down into the necessary layer.

    In the end I had to write JavaBeans to write the HTML which would then modify itself or not as the case may be...

    It was not merely a dog. It stank, whatever way you looked at it. Consequently the company never touched a DHTML project again and when they finally decided to upgrade the site they simply wrote a flat HTML version.

    I get flashbacks just thinking about it.

    But as a result I learnt that using a non-standard, custom server response may reduce project maintainability. And may reduce the likelihood of you keeping your job.
  • by pbhj ( 607776 ) on Thursday September 22, 2005 @09:44PM (#13626483) Homepage Journal
    No.

    You're thinking, no doubt (?), of trademark law. Trademarks are technology specific. So unless "someone" is creating a cleaning solution and "passing off" that product as Colgates (?) Ajax ...

    Colgate could still sue. But they shouldn't win!

  • by fforw ( 116415 ) on Thursday September 22, 2005 @11:46PM (#13626927) Homepage
    The article is surely a good entry to developing java webapplications with "AJAX" (Can't someone invent a better name?).

    For me (I am the author of japano [sourceforge.net], an MVC/JSP engine also containing dynamic javascript integration features), the following additional principles are were important:

    • Usability first. Don't use AJAX without a decent fallback. Don't use AJAX just because you can. Use semantic, standard-conform HTML/CSS layouts.
    • Use JSON [json.org] instead of XML
    • Keep it simple. No object brokering or other fancy things. JSON transports data. Javascript requests and browser requests uses the same mechanisms.
    • Integrate. AJAX has quite some complexity overhead. Try to minimize that complexity by offering framework assistance. Japano offers two different AJAX mechanisms. Javascript views [fforw.de], and Partial updates [fforw.de].

Neutrinos have bad breadth.

Working...