File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes When AJAX vs. scripting (mainly for Frank Zammetti) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "When AJAX vs. scripting (mainly for Frank Zammetti)" Watch "When AJAX vs. scripting (mainly for Frank Zammetti)" New topic

When AJAX vs. scripting (mainly for Frank Zammetti)

Rob Cromley

Joined: Aug 30, 2004
Posts: 24
I laughed out loud today when I saw what the book giveaway was (I think you'll see why I may need to buy it for a few folks I work).

Basically, at work we do J2EE development using Struts and Javascript for awhile now (pretty standard stuff). During discussions about architecting a new project one of the managers started expressing that he wanted to use Ajax extensively in an upcoming project. I'd love to get into an Ajax project, but I didn't feel that it was a good fit for what we were doing (the project was already very server intensive and Ajax would have only been used to do syntactical checking on the browser that could just as well be done using Javascript).

What is the rule of thumb that you should use to determine when to use Ajax and when to use scripting such as JavaScript? My understanding is that Ajax is great when you have fields on the screen whose functionality require alot of data behind the scenes (for example, when you type in a zip code Ajax is great for validating the zip code and filling-in the city & state). What other things should be considered when deciding which direction to go?

SCJP(1.4), SCWCD(1.4), SCBCD(1.3), SCEA(part 1), SCJD
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63857

One of the problems facing Ajax these days is that is the victim of its own hype. Sort of like where XML was 5 years ago... (remember nonsense like "we don't need a database, we have XML!"?), resulting in a rush to use it for things that it really isn't suited for,

I use Ajax extensively in my applications, but only for instances where server access is absolutely necessary.

When it comes to validations, if context-free validation can happen on the client, there's no need for a useless server round-trip just because it uses "sexy" technology. (And, of course, the server code never assumes that client-side validations have taken place when the data is finally submitted).

Ajax has a well-deserved and important place in our web development toolboxes, but like any other tool, it should be used wisely.
[ May 04, 2007: Message edited by: Bear Bibeault ]

[Asking smart questions] [About Bear] [Books by Bear]
Rob Cromley

Joined: Aug 30, 2004
Posts: 24
Thanks Bear (that's basically my thinking....glad to see I'm not completely crazy).
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1323

it uses "sexy" technology.

so developer need to think sexy.

[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Matthew Alesi
Ranch Hand

Joined: Sep 13, 2006
Posts: 38
[Thread hi-jack removed. Please start new topics for your own questions.]
[ May 04, 2007: Message edited by: Bear Bibeault ]

Current CS undergrad
SCJP 5.0
Frank Zammetti
Ranch Hand

Joined: Dec 16, 2004
Posts: 136
I definitely echo Bear's comments. I've mentioned in a few posts here that I'm in the final stages of a major, highly complex app at work that we've been developing for a year or so now, and it's very heavily AJAX-based. It had to be because of the requirements, there's just no way to have pulled off what we did without it.

We're the first project at my company to approach web development this way... well, not really... the lasst four major systems I built were along the same lines, but this is the first "official" AJAX project, and definitely the most high profile.

The interesting thing is that now that we're viewed as a huge success, we've kind of proved that the approach is viable. I've sat in a number of meetings recently, or had such meetings described to me, where people are jumping on the AJAX bandwagon, trying to cram it in everywhere they can. This is clearly not the right answer because as Bear said, it's one tool in the toolbox.

I like that the thought process is shifting to more "next-generation" archicture, i.e., RIAs. I've been preaching that approach for probably 5 years or so now at least, but it's starting to get traction now that we've pulled off what we did. But, you can easily go too far and think you have to do everything that way, and that's just not the right frame of mind either.

How do you know when its appropriate? I'm not sure I can give you a concise list of criteria... I tend to listen to what the business analysts and/or customers are saying... if they say things like "fat-client", or "dynamic UI" or "non-blocking operations", things along those lines, then an AJAX type of app is probably appropriate. I can tell this project I'm referring two, plus the last three major systems I developed, all started with comments like "we want a Windows-based application on the web". Now, putting aside whether they should have just been Windows apps to begin with, that pretty clearly leads you down a certain path, certain approaches to things. You start to hear those sorts of requirements more and more, especially now that people see it's possible to do it, to a large degree.

-- <br />Frank W. Zammetti<br />Founder and Chief Software Architect<br />Omnytex Technologies<br /><a href="" target="_blank" rel="nofollow"></a><br />AIM/Yahoo: fzammetti<br />MSN:<br />Author of "Practical Ajax Projects With Java Technology"<br /> (2006, Apress, ISBN 1-59059-695-1)<br />and "JavaScript, DOM Scripting and Ajax Projects"<br /> (2007, Apress, ISBN 1-59059-816-4)<br />Java Web Parts - <a href="" target="_blank" rel="nofollow"></a><br /> Supplying the wheel, so you don't have to reinvent it!
I agree. Here's the link:
subject: When AJAX vs. scripting (mainly for Frank Zammetti)
It's not a secret anymore!