Slashdot Mirror


AJAX Buzzword Reinvigorates Javascript

samuel4242 writes "Javascript may have been with us since the beginning of the browser, but it's going through a renaissance as companies like Google create Javascript-enabled tools like Google Maps . There's even a nice, newly coined acronym , AJAX for "Asynchronous Javascript and XML". A nice survey article from Infoworld interviews Javascript creator, Brendan Eich, who says that this is what he and Marc Andreessen planned from the beginning. Perhaps AJAX will finally deliver what Java promised. Perhaps it will really provide a solid way to distribute software seamlessly."

21 of 541 comments (clear)

  1. AJAX also good for... by Anonymous Coward · · Score: 5, Funny

    cleaning tub
    cleaning toilet
    getting first post

    1. Re:AJAX also good for... by nahdude812 · · Score: 5, Informative

      Oh, and getting all the Slashdot pundits on their soap boxes, preaching about technologies they don't really understand, and making dire predictions about the unworthiness of the tech.

      Seriously, being someone who actually has quite a bit of *real* experience with Ajax (though we were doing it before the term was coined) across multiple browsers, I can say that the ratio of comments which demonstrate the author understands the full implications of Ajax to those who are just spouting nonsense is about 1:75. I've never read an article on Slashdot before where so many comments missed the target, and I feel like I've been around Slashdot for a little while.

      The idea behind Ajax *does* revolutionize the web paradigm. All this nonsense about cross browser compatability issues is just that: nonsense; it works in Mozilla, Firefox, IE, Opera, and Konqueror each on their respective available platforms. I've actually heard people talking about "Ajax enabled advertisements instead of Flash." Other gems like "Ajax doesn't do anything that a well programmed web application can't do," and "It's just needlessly complex web pages" only point to users who fail to grasp the fundamental concept.

      Let me tell you: Ajax is FAST. You don't realize how unresponsive web pages are until you get to play with a web app that is always waiting on you, no the other way around. When I submit information, why do I need to wait for that information to get to the server before I can begin to perform another operation if that operation isn't dependant on the previous? Click Add To Cart then *immediately* start searching for the next item. Stuff like that.

      The amount of data being exchanged is far less (if you do it RIGHT, you people who are talking about using the XMLHttpRequest.responseText property, this does NOT include you). Rather than reload an entire page with all the framework, you're loading only the portion of the page that changed.

      Aside from piecemeal page loading, you also get to load only the relevant data. For example, rather than load a form, and all the form formatting to make the text fields line up correctly, and all the validation code to validate that form, you load a series of XML tags that contain only the basic information needed to tell the client how to lay out the form. The client takes care of generating the HTML for the form, and your form data looks more like this:
      <input name="username" label="User Name" required="yes" minlength="5" maxlength="10"/>
      versus
      <tr class="lightRow"><td class="labelColumn"><label for="username">User Name:</label></td><td class="inputColumn"><input id="username" name="username" maxlength="10"></td></tr>
      , then later form validation code.

      Often times your data fits inside a single TCP packet.

      I'll make this concession: yes, this is stuff that could be done before the Ajax philosophy using Flash or Java Applets. But both require a plugin, and one of them is even proprietary. Both have potential firewall issues, and neither will run on a vanilla Fedora Core build. Both require higher resource consumption for the user, and both lend to a feeling of sluggishness on the site for the user.

      That's not to say that it's not without its dangers. Like all web apps, you can't trust the data from the client. Here the client gets a bit lower level access to the data. You still have to make sure that you're protecting yourself well against data poisoning attacks.

      The thing I like most about this model though is this: It's truly a MVC (Model View Controller) framework.

      The model is of course your server side logic scripts. The View is the browser (the server side logic scripts send back generically formatted data, the browser does all the display). The Controller is the combination of XMLHttpRequest object, and the processing management script on the server. It's very conceivable that you could write a new front end for your application by simply

  2. Rewriting history? by Anonymous Coward · · Score: 5, Informative

    Javascript may have been with us since the beginning of the browser...

    Huh? I don't seem to remember seeing it until about '96 or '97. That's just a wee bit later than the beginning of the browser...

    1. Re:Rewriting history? by brundlefly · · Score: 4, Informative

      JavaScript first arrived in Netscape 2. In that browser most of the core language was in place, making it one of the first ever prototype-based OO languages to go from concept to reality.

      But in Netscape 2, there were not very many hooks from JavaScript back into the HTML. You had a document object and a window object of course, but beyond that about the only "DHTML" you could do was mostly restricted to manipulating form values and popping open new windows. Useful, to be sure, but that was about it.

      In Netscape 3 they added the document.images array, and that began the whole image-swapping madness that got everyone hooked on JavaScript, for better or worse.

      And then in NS4/MSIE4 they added the competing, incompatible DOMs that got us into the hell years of DHTML. DHTML as a term arrived with the version 4 browsers.

      Give JavaScript some credit for surviving its own history... the language has been through some very rough years, only to now finally get some credit for being a powerful web tool.

  3. AJAX Won't Deliver... by NardofDoom · · Score: 4, Insightful
    ... until every browser does things the same. A lot of the current applications for Google Maps (like this one) don't work in Safari.

    Unless standards are complied with fully there can never be "one programming language" for web scripting. Anyone who's had to debug Javascript in IE that works in Firefox knows this.

    --
    You have two hands and one brain, so always code twice as much as you think!
  4. this is good, and here's more material by yagu · · Score: 5, Informative

    For me, the crux of the usefulness and eventual adoption and finally complete embracing of AJAX lies in the article's paragraph:

    Some of the buzz surrounding AJAX has been generated by Web designers as well as programmers. AJAX?s flexibility is invigorating for Web designers because JavaScript can control any aspect of any images or type on a page. Fonts can grow or shrink. Tables can add or lose lines. Colors can change. Although none of these capabilities are new to programmers accustomed to building client applications -- or, for that matter, Java applets -- they are novelties to Web designers who would otherwise be forced to rely on Macromedia (Profile, Products, Articles) Flash.

    I've seen what Google has done with AJAX (e.g., Google suggest), and it's stuff I never imagined could be so repsonsive in a web context. For me it starts to make programming fun again, and web programming an acceptable form of application development.

    When browsers and web first emerged I could see the writing on the wall, but I wasn't happy about it. Browser application writing from the programming perspective was probably the single most giant leap backwards in technology for me (not including technologies introduced by Microsoft)....: you mean, all the years I've spent honing skills writing applications no longer apply? You mean I no longer have "state" as a tool for maintaining sanity in my application???? Hwaahhh??? I have to do what to change the web page???

    While there have been some technologies (ASP, JSP, etc) to help with these issues, none have addressed the responsiveness issue with the web page round trip message loop. AJAX comes close. Now all I have to do is learn it.

    For a great example of the responsive nature of this (I've referenced this before), go to Google Personal Home, set up your own home page, and play... Configure your modules by dragging them around... open and close your g-mail previews. This all starts looking alot like programs actually running locally on your own machine. (I'm assuming all are familiar with and have played similarly with Google Maps.)

    Additionally, here are some very good resources to learn more about AJAX:

    That's it, I'm done.

  5. Re:Slower than Java by natrius · · Score: 4, Insightful

    Having to go back to the server again and again and again to get tiny amounts of data doesn't sound too nice to me.

    That's what you do each time you click on a link to go to a different web page within a site. With AJAX, you only get the data you need. It's not slow. Have you used Google Maps? GMail? That's what's going on behind the scenes, and it makes the experience far better.

  6. Java by HRbnjR · · Score: 4, Insightful

    People keep talking like Java has failed and is now dead and gone.

    I have been programming primarily in Java since 97, and if you ask me, it's just *starting* to pick up steam.

    The language itself is just becoming mature - with big strides (generics, etc) in Java 1.5. And only now are we seeing alternate implementations to Suns, with GNU Classpath approaching a million lines of code, and GCJ compiled applications shipping in Fedora Core 4. Java applications such as Eclipse are also just starting to become popular, and Java API's for things like GNOME are just appearing on the horizon.

    So quit calling Java dead :)

  7. Open up AJAX by iamthesamurai · · Score: 5, Insightful

    There is a need to standardize (as much as possible) the way that AJAX will work in the browser. There are a lot of code-writers and code-copy-n-pasters out there. When you visit one of these sites, you know because the browser may act funny due to poor programming/hacking of Javascript interacting with the server. AJAX is much bigger than just XML messaging, it's an opportunity to bring a more traditional application model to the browser via Event handling and dispatching. Notice that if you have an engine or framework that is well built, it's quite simple to add event handlers like key presses or mouse clicks or even drag-n-drop. If one was to script each element on a page, that gets heavy and can slow the browser. Which - btw, is why AJAX hadn't caught on until recently: computing resources were not sufficient in many cases.

    That being said, everyone should look at http://www.sourcelabs.com/ajb/AJAX Mistakes. There's also a nice list being compiled at http://www.openajax.net/OpenAJAX .net. This combination of technologies has been around for a while, however, as people find them more useful and interesting, there is a need for good information and a solid foundation for folks to work off of.

  8. WANTED - AJAX DEVELOPER by BillsPetMonkey · · Score: 5, Funny

    * Bluechip client
    * Excellent Package
    * London, Engliand Offices

    Requirements -

    * 5 years of writing AJAX apps for enterprise clients
    * 5-10 years .NET Experience on Linux
    * At least 15 years Linux experience

    Call now or apply online by clicking here!

    --
    "It's not your information. It's information about you" - John Ford, Vice President, Equifax
  9. Are we sure it's the buzzword? by twifosp · · Score: 4, Insightful
    I find it hard to believe that the buzzword itself breathed life back into Javascript like the title implies.

    I think maybe the slick apps like google maps is finally showing what good code CAN do, instead of the bloated bug ridden javascripting of yesterday.

    Or maybe I'm just not transcending expectations by thinking outside of the box, and therefore my toolset isn't capable of brigding the information gap causing a chasm with my ability to think forwardly.

    I'm struggling to identify which is worse: The day when we report that a buzzword has made progress, or the day a buzzword actually creates progress.

  10. AJAX + JSON = Powerful combination by MarkEst1973 · · Score: 4, Interesting
    AJAX is great, but parsing XML always sucks. The XmlHttpRequest object also has a property called ".text", which returns the text value of the data.

    Set your content type to "text/javascript" and you can send data over the network and have it be perfectly legal and ready to use. NO XML PARSING!

    JSON (JSON.org) just happens to be legal Python syntax... which makes me think...

    hmmm.... Google has a huge server farm and is renowed for using Python... Google Maps talks client/server using Javascript, not xml... Python and Javascript shared JSON sytax for serializing objects... hmmm...

    It is a very efficient combo: Python, Javascript, JSON, mod_python.

  11. Ajax Q&A... the real one by grangerg · · Score: 4, Funny
    Q.Did Adaptive Path invent Ajax? Did Google? Did Adaptive Path help build Google's Ajax applications? A.Yes. We wanted to call it HTTP, but that was already taken. Q. Is Adaptive Path selling Ajax components or trademarking the name? Where can I download it? A. Oops. Sorry; fooled you. It's not a product; cool acronym though, right? Q. Is Ajax just another name for XMLHttpRequest? A. Damn you kids are smart. Wait! I meant "No". We put "CSS" in there too, and "XML". Yeah; XML changes everything. Q. Why did you feel the need to give this a name? A. Two words: Midlife Crisis. Q. Techniques for asynchronous server communication have been around for years. What makes Ajax a "new" approach? A. Because I said so; I'm Jack Bauer! Q. Is Ajax a technology platform or is it an architectural style? A. Is using the BLINK tag a platform or is it an architectural style? Snatch the pebble from my hand, Grasshopper. Q. What kinds of applications is Ajax best suited for? A. Hmmm... That's a tough one. How about "web pages"? Does that sound nice? Q. Does this mean Adaptive Path is anti-Flash? A. Yes. If we liked Flash, why would we pull our hair out attempting something this complex in Javascript? Q. Does Ajax have significant accessibility or browser compatibility limitations? Blah blah blah... A. My sources say "Yes". ...but if you shake the magic 8 ball again, who knows? Q. Some of the Google examples you cite don't use XML at all. Do I have to use XML and/or XSLT in an Ajax application? A. Yes. We put "XML" in the acronym! Of course you have to! Why? ...because ...because SHUT UP! Q. Are Ajax applications easier to develop than traditional web applications? A. Duh. Are you stupid? Of course they are. We called it "AJAX"; isn't that teh ish? Q. Do Ajax applications always deliver a better experience than traditional web applications? A. Only if we make them. Everyone else sucks.

    And on a serious note: Who was the moron who made the onreadystatechange event handler? Why couldn't you just pass in a reference to the XmlHttpRequest object so people wouldn't be forced to use global variables to store the reference? Is that so hard?

    1. Re:Ajax Q&A... the real one by wootest · · Score: 4, Informative

      I do believe Microsoft was the moron that made the onreadystatechange event handler, along with the rest of the XMLHTTPRequest object.

  12. Ajax mistakes by afd8856 · · Score: 4, Informative

    Just today I was looking at this page It's a list of ten easy to do mistakes in Ajax apps. Some of them are not that easy to avoid...

    --
    I'll do the stupid thing first and then you shy people follow...
  13. Yeah, But... by Greyfox · · Score: 4, Insightful
    You're still programming in a brain damaged environment. The browser provides a tiny fraction of what the entire system is capable of and a tiny fraction of the refinement of the programming interfaces that have been around since the '70's. The only way that programmers will be able to cope with these shortcomings will be to increase the scope of the browser until it pretty much becomes the OS. At which point we will have gone full circle.

    That being said, this does look like the least annoying of a lot of really annoying hacks to attempt to shoehorn stateful programming into an inherently stateless paradigm. Personally I think we should be rethinking the underlying infrastructure before we build too much on top of it.

    --

    I'm trying to teach myself to set people on fire with my mind... Is it hot in here?

  14. Re:Correct me if i'm wrong but... by ad0gg · · Score: 4, Informative

    Its been out since IE 5.0 which was released in 2001. I've seen intranet apps use it all the time. Hell quick search, revealed old articles on the subject. I don't get how a 4 year old technology becomes new by simply giving it a stupid name. I even love how the article fails to mention that its been around for 4 years. And i love how the grand parent gets modded flamebait by merely pointing out that it was a Microsoft invention.

    --

    Have you ever been to a turkish prison?

  15. Re:Javascript? by telbij · · Score: 5, Informative

    Quite honestly javascript is a very poor language.

    Actually, Javascript is surprisingly robust. Probably you're referring the platform inconsistencies, which have long been a showstopper. But with recent versions of browsers supporting the javascript standard (ie. ECMAScript) increasingly well, a lot of the major wholes are closing, and you really can write cross-platform javascript with a minimal compatibility layer.

    Javascript is not meant to be a large-scale programming language... it doesn't have strong-typing or other features that you want when developing million-line applications. However, it is still an extremely powerful language providing things like full object-orientation (everything is secretly descended from the window object), comprehensive hooks to HTML, functions as data, regular expressions, flexible data access (eg. objects as hashes), and robust event handling.

    I used to think of javascript as a toy language, but when you get to down to it, it does what it needs to do very cleanly and efficiently without imposing unnecessary overhead on the programmer.

  16. Re:Ruby on Rails and AJAX by mortonda · · Score: 4, Informative

    True, RoR is server based, but AJAX requires an interaction between both client and server. RoR includes a javascript component called Prototype, which helps handle the client side of things. In addition, RoR includes many helper functions that help you write the appropriate javascript functions, without needing to know much javascript.

  17. AJAX is not the end all... by eno2001 · · Score: 4, Funny

    ...and be all of client side scripting. There is another...

    BLEACH (Bloatware + Leanware + Emacs + (x86) Assembly + C + Heroine) has been working wonders for my development. I usually start the day by shooting up in my office, then I start up all of the Office apps (bloatware) on my co-worker's PC to slwo him down. After that, I load up ACIDWARP.EXE (leanware. No DLLs, libs, nothing, jst one EXE and it's small for what it does) on my boss' PC which stuns him for a few hours so he can't keep track of what's going on in the office (usually play Purple Haze in the background). I then open up Emacs on my box and set to work redesigning everything (Screw WYSIWYG. It's overrated.) I also write a lot of my CGI in assembly language to keep the resource usage low and the code tight. C, when it's needed, which is almost never because of how well I can do things in assembly. And finally, another serving of heroine to keep the Jedi Mind tricks fresh. So far, this plan has worked so well, that I've been shuffled through about 70 different companies this year alone. My talents are in demand!

    --
    -"...bad old ideas look confusingly fresh when they are packaged as technology" - Jaron Lanier (Digital Maoism on Edge.o
  18. Re:AJAX will also kick your ass by Jellybob · · Score: 4, Informative

    The thing your missing is Prototype - a Javascript library which attempts (most successfully) to provide cross-platform objects to access common issues.

    It's worth the price just for the $() function, which does a document.getElementById() on the argument ;)