Advanced Requests and Responses in Ajax 209
An anonymous reader writes "The Web is no longer a place where simple applications are tolerated; 'users have become more advanced, customers expect robustness and advanced error reporting, and managers are fired because an application goes down 1 percent of the time. It's your job then, to go beyond a simple Ajax application that requires a more thorough understanding of XMLHttpRequest.' This DevWorks article tries to help developers use Ajax to build a solid foundation in which an application handles errors and problems smoothly."
CS101 (Score:4, Insightful)
Um, aren't these concepts something we learned in college??? This is just basic stuff... although I think it highlights how RAD languages can teach you sloppy coding habits if you don't take the time do do things correctly.
Unfortunately... (Score:5, Interesting)
(a) Hire engineers who know engineering and are crappy programmers, and make them learn programming, or
(b) Hire CS majors who don't know engineering, and spend 4 years to teach them engineering
(a) makes more sense to me. A lot of my code looks like crap, and I know my CS friends could do better quicker, but they don't know the engineering principles I do. Long story short, I didn't have CS101, CS102, etc. There are a lot of us out here who are asked to code, who weren't brought up to be coders, who have to be taught some principles that aren't immediately apparent
Re:Unfortunately... (Score:5, Insightful)
c)Have the people who understand the engineering write pseudocode algorithms and work hand in hand with real programmers.
The advantages you get from this- code that doesn't look like shit and have major architectural short commings, and much easier/cheaper maintenance. While I'm sure an Aero can learn to do basic programming in a month or so, it does take a few years to write good, well designed code. Whereas an experienced programmer can write equivalent functionality in 1/10 the time. By working together, you end up with higher quality software for much cheaper. This is the same way you see EEs and MechEs working with programmers in the embedded world.
Re:Unfortunately... (Score:3, Insightful)
Re:Unfortunately... (Score:5, Insightful)
Re:Unfortunately... (Score:5, Insightful)
Re:Unfortunately... (Score:2)
Re:Unfortunately... (Score:2)
Until management learn this basic fact, IT will always suck as a job.
Re:Unfortunately... (Score:2, Insightful)
V&V (Score:2)
Re:V&V (Score:2)
Like I said, this is what is normally done in the embedded indus
Re:V&V (Score:2)
(1) as implemented in the code
(2) as they interact with the rest of the system (other algorithms)
You can't ask someone who doesn't understand the physics behind the problem (IE: a CS) to do that. You need the AE to do that. And you can't ask the AE to do that if he doesn't know the language well enough to jump in and mess around with it. I'm not saying throwing a CS or two in the mix is unwise,
Re:V&V (Score:2)
Re:V&V (Score:2)
Motor feedback circuits are easy. Lego's Robotic Invention System 2.0 contains enough parts to build a rudiamentary scanner, many grade school and high school kids have built scanners with them (google it). Not trying to belittle your accomplishment.
I disagree with your opinions but I can't really go into more detail on the public forum. Sorry. Bio may clue you in as to why.
Re:V&V (Score:2)
I'm happy your friend gets a good chuckle. Hopefully he's a passenger on one of the craft you programmed for.
Re:V&V (Score:2)
Re:Unfortunately... (Score:2)
I don't think it's too much of a stretch to think that in the near future, everyone in technical fields will have to know how to build good software, not just know how to make a "hello world". It may not be the best software, and there will still be plenty
Re:Unfortunately... (Score:2)
1)Not everyone has the mindset to be a good programmer. I'm not saying that the average engineer can't learn basic programming- they probably can. But I know some damn good engineers, and even some good math majors, who failed all their programming classes. They had no interest, and really didn't have the ability to break down problems the right way.
2)Time. An engineer already has a shitload to learn. Even bachelor degrees are inching twoards 5 years
Re:Unfortunately... (Score:2)
Re:Unfortunately... (Score:2)
Re:Unfortunately... (Score:2)
Most people with a CS degree should have more than enough understanding of Physics and Mathematics that they should be able to interpret what you're doing. Couple that with the fact that once they've been in your system a bit and understand the lingo and systems, they can really start to flow.
It's quicker right now....maybe. It's easier right now...maybe. It's cheape
Re:Unfortunately... (Score:3, Insightful)
Even better, get them to pair-program. I heard a talk at XPDay London recently by a guy from a company who build gear boxes. They had similar problems where either developers didn't understand the engineering well enough or the engineers produced poor code.
They began to implement XP (which we don't need to go into) and had developers and engineers pair-program on the tasks. This was a huge
Re:Unfortunately... (Score:2)
Re:Unfortunately... (Score:2)
I disagree that this is preferable. It takes more than that same "4 years to teach them engineering" to get an untrained programmer writing code to the same standard of the hypothetical trained and experienced CS major.
This may be acceptable for some applications, esp. small, useful mathematical tools. The more sophisticated the project scope starts at (or grows to), the greater the benefit in having folks ar
Re:Unfortunately... (Score:3, Interesting)
Our code was crap and our applications extremely fragile. Nothing we produced was scalable or easily transferable from one client to another. Oh, everything worked after a fashion, but the architecture was comparable to a house of cards.
I agree that our engineering background was essential, but what they should have done i
c++ and javascript? (Score:2)
Re:Unfortunately... (Score:2)
Software is not to be taken lightly. The fact they have you programming in C++ scares me a bit. C++, as you probably know, is a rather low level programming languages with l
Re:Unfortunately... (Score:2)
Re:Unfortunately... (Score:2)
Re:CS101 (Score:2, Insightful)
Oh sure, *I* agree with your point about doing things the right way, but the average acronym loving project manager sees "RAD" and (aside from the "party-on dude" connotations), assumes it means he doesn't have to spend time developing. One of the many reasons I hate that term and encourage others not to use it. It convinves people not to think in a relative perspective... "Rapid" means "faster than doin
Re:CS101 (Score:3, Interesting)
Error handling wasn't taught well at my college [gatech.edu]. Yeah, you might fail one of Greenlee's assignments if you if you didn't check the return status of a system call, but that's not the same thing as knowing how to handle an error when you get one.
It wouldn't be difficult to add an error-handling module to an intermediate-level programming class. There are only a few basic response to any error situation: ignore it, propagate it, retry it, ask the u
Re:CS101 (Score:2)
However, SCRIPTING does. Growing up a C/C++ programmer, switching over to python ( which I love sofar ), I notice I have to work especially hard to
What's the difference? (Score:2)
I've seen (in school) C++ programs where the "programmer" had named all of their variables after fruits (strawberry, kiwi...), and all of their methods after greek letters (theta, alpha...). Style is style is style. You can't put a bad programmer in front of a c++ compiler and expect their code to be any better than it would have been in perl or python
Re:What's the difference? (Score:2)
Re:CS101 (Score:4, Insightful)
CS101 certainly touches on aspects of asynchronous programming, such as threads, but I suspect the student's first serious exposure is more likley to come in second or third year OS class. But in any case you have to expect a CS program to fill the student's heads with more knowledge than skills. I've even hired engineers with masters degrees who, while they had the basic theoretical knowledge needed to do this kind of work, don't have a decent feel for it.
The reason is that while they learned the theory, in practice details have always been taken care of by some framework or another. For example some ajax frameworks work by callback functions; clearly they're doing just this stuff under the covers.
I'm not saying this is rocket science; quite the contrary. Very, very little in CS is. Most practical skills in CS amount to this: attention to detail and taking care with making assumptions you make -- particularly knowing when an assumption can be trusted to hold and when it cannot. I've often reflected that doggedness and fastidiousness (well, mental fastidiousness at least) are equally important with intelligence in making a good programmer.
The problem is that programmers always have too many details to manage. Succeeding is what differentiates the good ones from the bad, and experience is very helpful. As in many things, an ounce of prevention is worth a pound of cure. It's all to easy to be careless or inattentive in the wrong places. Believing you know when to do this is what converts garden variety laziness into the hubris. Getting this stuff right isn't hard, but getting it wrong isn't hard either, in which case you end up with hard to debug problems or systems that are unresponsive.
Re:CS101 (Score:2)
First, you had to sit in front of the computer to use it. Then they invented terminals so you could sit far away and use it remotely. Then they invented portable/personal computers so you could take it with you and have it right in front of you again. Then they invented the web so you could use a program running on a computer far away. Now you just download the AJAX program and run it on your own computer again.
Of course each
Re:CS101 (Score:2)
The web is more than just another iteration. You can write a web application that transparently serves smart web browsers with a whole drag and drop interface, text-only browsers and dumb scripts.
Okay, so lots of developers are dumb and end up writing one or the other, but the idea is that you build the basic stuff, and add all the fancy Javascript and CSS on top. That way it works for both smart clients and dumb clie
Re:CS101 (Score:2)
Do you think the script writers would squeal too loudly if we added stuff like namespaces, strong typing and libraries to it? Having try/catch is respectable though.
And it's delivered as source code, not exactly efficient. It's onl
Bunk! (Score:2)
Fact is, the world is a complicated place. Not only do people, even highly trained professionals, make mistakes from time to time - situations change, often unpredictably, and even the most reasonable and appropriate strategies suddenly become grossly inadequate.
Software solutions are developed with budgets and schedule
Ironically (Score:4, Funny)
Perhaps someone should write an article on how to write robust AJAX code. Oh, wait...
Corrected URL (Score:5, Informative)
http://download.boulder.ibm.com/ibmdl/pub/softwar
Taking the "%20" away from the final "/" made it work.
(There should be no spaces in the URL.)
nothing too new (Score:2, Insightful)
I think the article covers some things that are missing in a lot of ajax classes available, but really is nothing new. My own ajax class is far, far superior (trying to get the okay from work to OSS it).
Too many classes are using a global httprequest object. This is not good if you are doing many requests (though I suppose uses less memory). There's also no timeout for graceful handling of a slow server. I've done quite a bit in the way of error handling.
At least this one doesn't make you learn a da
Re:nothing too new (Score:2)
Good for Them (Score:3, Insightful)
That's good, because none of the commercial "enterprise class" software that I have to work with handles errors and problems smoothly. They just crash or send an error message that has no relation ot the actual problem.
Re:Good for Them (Score:2)
Yeah, all the "enterprise class" software I code just throw some odd "NullPointerExceptions" when things go wrong. Ajax could really help me with that.
Users.. (Score:5, Insightful)
They really haven't actually. They've stopped being mostly geeks and academics and now the internet is open to all. Users are much, much less advanced today than they were ten years ago. What has changed in more recent times is that the users now they're think more advanced. They're presented with interesting social networks (FlickR, Blogger, deli.co.us, etc), and they're capable of using these straightforward interfaces with lots of handholding (rebranding categories as tags for example) and they get the impression that they're learning something. Does that mean they know, or care, what an XMLHTTPRequest is? Nope.
The same goes for customers. Yes, they want advanced reporting and robust apps
As for managers being fired for an application being unavailable 1% of the time
Re:Users.. (Score:2, Informative)
If high availability is key then you'd better not be using anything beyond HTML.
Uh... how about having an app degrade nicely? In most cases it's not that tough. So for the large majority that can take advantage of your whiz bang web app, go ahead and use AJAX (where it makes sense) and just be sure to have it degrade nicely for browsers that are not ajax aware and then also for browsers that are not handling javascript.
Re:Users.. (Score:2)
I am a big proponent of this way of thinking, and I design *all* my apps to degrade gracefully. Nobody has ever asked me to code this way and nobody seems to care that I do it, but for me it is a point of personal pride.
And you know what, it really isn't all that hard to do this. For starters, you check your input params on the server. Many people think they don't have to do
Re:Users.. (Score:3, Interesting)
For all of you who've got adblockers on and javascript and flash turned off, welcome to the beginning of the end. I hope you enjoy cruising the crusty bowels of the Internet while the rest of us enjoy Flickr and the rest of the really tasty web 2.0 apps that are co
Re:Users.. (Score:2)
Re:Users.. (Score:4, Interesting)
Oh the delicious irony of seeing this post immediately after a sensible poster [slashdot.org] mentions graceful degradation.
See, I actually see things differently then you do. I do run with JavaScript disabled for the most part and AdBlock turned on. And you know what? I don't really have that many issues with websites. And if I do run into issues? Well, I really don't care if my browser doesn't work for them.
I think perhaps just because you have "They're not seeing our ads? Well F them then!" attitude towards customers does not a) mean all companies do and more importantly b) not all developers do. Standards are generally designed to implement some backward compatibility. I don't think, despite your gloomy predictions, that this is likely to change anytime soon. The majority of (useful, interesting) sites will continue to keep this in mind in order to take advantage of as many eyeballs as possible.
So I think I'll continue to use ad block, watch all my TV on DVR and skip the commercials, avoid tracking tools, like toolbars that integrate with my browser and in general keep myself as ad free as possible.
Meanwhile you and the rest of the mass marketing industry can try the RIAA route and whine to the government about it. Maybe they'll make my DVR and ad blockers illegal. Then, I guess you win.
Re:Users.. (Score:2)
Let me clarify that we don't actively block our content from people who can't view the ads. That would be a waste of time and money. But to go out of our way so "just_another_sean" who's so frickin l33t that he's got his Firefox adblockers and flash and js disablers installed and is gleefully laughi
Re:Users.. (Score:2)
Re:Users.. (Score:2)
Re:Users.. (Score:2)
If you make your site unusable without Javascript, Flash, Java and whatever else you want to impose, you *do* end up missing some customers. Making your site gracefully degrade means that people won't think that you are a failure as a programmer. See, when people go to a site and get broken links, partial page loads and other things like that, they think it is the sites fault, not their configuration (your Nemesis in the parent posts notwithstanding).
That ma
Re:Confusion About Customers (Score:2)
Re:Users.. (Score:2)
How the hell are you a customer if you refuse to view the ads?
Ok, first what are you selling? Just because I don't see your ads does not mean I'm not a customer. Tigerdirect sends me flyers (at home and work) and email all the time that go in the garbage the minute I get them. But guess who I buy 90% of my and my company's computers from? All the Dell, Newegg and IBM popups in the world don't change
Re:Users.. (Score:3, Interesting)
Re:Users.. (Score:2)
https://ancillary-proxy.atarimworker.io?url=https%3A%2F%2Faddons.mozilla.org%2Fextensions%2Fmoreinfo.php ?id=722&application=firefox [mozilla.org]
I can selectively enable javascript and every other web plugin for websites. If I need to see a site with javascript that I don't trust enough to add to my "always allow" list, I just temporarily grant access for the browser session.
Combining that with adblock I enjoy (and pay to subscribe to) flickr and other sites, overly hyped web 2.0 apps, and such with no crappy javascript/flash ad
Re:Users.. (Score:2)
Re:Users.. (Score:3, Insightful)
Re:Users.. (Score:2)
Those users aren't cool enough to count. Not for AJAX man!
Re:Users.. (Score:2)
That's got to be the most made-up stat I've seen in a long while. The actual number is much closer to
Pretty sparse (Score:4, Informative)
Any decent webdev entering the field should know about http status codes, HEAD requests and all that. Also it should be noted that article didn't even mention how many times state 3 is hit for a particular request - I got caught by that one once.
Re:Pretty sparse (Score:2)
frameworks reduce need for low level details (Score:3, Interesting)
I think this is true right now, at least to some extent, but as frameworks solidify and become proven, there will be less benefit to being "intimately familiar" with the XMLHttpRequest object. Of course, knowing more about the underlying technology can't hurt, and you will need to know them if you are the one writing a framework.
For a very good source on frameworks, take a look at http://ajaxpatterns.org/Ajax_Frameworks [ajaxpatterns.org]
the web IS such a place! (Score:3, Insightful)
Sure it is. Most web applications that I use, whether if they make use of AJAX or not, could certainly be plenty usable and valuable without AJAX.
AJAX makes some things possible that aren't possible using plain HTML, but it doesn't make ALL plain HTML so much better that it would be impossible to imagine the site without it.
simple != intolerable (Score:5, Insightful)
Not so. Simple = GOOD, just look at the success of google; no fancy front end required. AJAX, like good special effects in a movie, can enhance the end-user experience when applied selectively and intelligently. They are NOT an end in themselves.
The truth is, the web is a place were only USEFUL applications are tolerated, whether or not they use AJAX.
Re:simple != intolerable (Score:2, Insightful)
I agree with you. Content and usefulness matter. And Simple = BEAUTIFUL.
Yet, Simple != Easy to create. And Simple != Low Tech. Simple = Nothing excessive.
And as far as AJAX helps to save some mouse clicks and page reloads, it may be used to weave really simple web.
The Web is no longer... (Score:2, Funny)
The Web is no longer a place for information exchange. It is a place to invest your money, to hire more and more coders/artists/testers/managers, to maintain all this eye-candy. There is a reason: It looks just like a real application inside your web browser!
We don't have anything special to say. But now instead of looking for a `Back' button, you may drag-n-drop our whole corporate site directly to your Recycled Bin!
Re:The Web is no longer... (Score:3, Insightful)
Rather than taking an incremental approach and altering the core purpose of "web browsing", why don't we get all of the majo
Re:The Web is no longer... (Score:2)
Web applications have a number of good qualities, from the user's perspective. They allow ubiquitous access, work on essentially any modern computer (Firefox will run apps on Windows, Mac, and Linux with no problem), and can be kept updated automatically. I don't know where yo
Re:The Web is no longer... (Score:2)
GUI libraries pre-date the Internet. I think that today, they're mostly there for legacy purposes. From a developer's perspective, a single code base that runs everywhere is much more appealing.
While I will agree that SOME GUI libraries predate the net.. I feel like many GUI libraries had so much of the functionality that we are trying to emulate now with AJAX in the browser, that it's kind of silly that we can't use na
Re:The Web is no longer... (Score:2)
Perhaps what we need is as simple as exposing these additional controls through HTML's <input> element or XForms.
I think very few people truly understood the potential of what the web could become...Sir Berners-Lee certainly didn't. One of the few who did might have been Microsoft. In an ironic way, Microsoft's sudden a
Re: (Score:2)
I would prefer the JSON way (Score:4, Informative)
Re:I would prefer the JSON way (Score:3, Interesting)
Re:I would prefer the JSON way (Score:3, Informative)
1 percent is a lot (Score:2)
No longer tolerating what?? (Score:3, Interesting)
Where's the ajax on msn & yahoo
Ajax is a "web two point oh" buzzword, and 99% of "web two point oh" services/systems aren't going to be a success just because they utilize it.
I'm not disputing it can be useful and add something to an application, but the hype outweighs the benefit.
One thing I fear about ajax is the poor standards many developers work to - how long before we see phpbb/phpnuke/et al tearing servers apart because each visitor is suddenly making an extra 10 database queries a minute while previously they'd alt-tab back and hit refresh every few minutes?
Re:No longer tolerating what?? (Score:2, Insightful)
No, those things would be useless... AJAX is about improving the user experience, not loading as much crap onto a page that you can, just 'cause.
Echo2 (Score:2)
If you want a proper application that handles user and error conditions gracefully, it helps to use a tool that aids good design.
Echo2 lets you build AJAX applications as if you were writing a swing app.
No messy html/javascript. You don't even need to know that XMLHttpRequest exists.
I'm currently in the process of building an AJAX app for a large financial institution and all I can say is thank god I don't have to mess about in javascript to make a nice applicatio
ObRoR (Score:2)
That does it! AJAX officially==bullshit! (Score:2)
Re:AJAX? (Score:3, Informative)
Too bad it requires JavaScript!
Re:AJAX? (Score:3, Insightful)
AJAX Privacy and Security? (Score:5, Interesting)
One thing about Javascript is that it is very aware of the client's environment--we can use it to determine screen size, colour depth, browser type, browser history and so forth. Until the introduction of the XMLHTTPRequest object, developers were limited in how they could bring this information into the server. It wasn't impossible (you could do stuff with traditional javascript and server-side programming involving hidden input tags, cookies, automatic page submits/reloads, etc), however the user would usually have a visual cue (IE would produce an audible "click" during page submits and redirects by default, the page would blink, the "throbber" icon and status bar would indicate an HTTP request was happening, etc). Furthermore, such schemes were more easily breakable (disablihng cookies, etc).
Now with AJAX, a coder could write client side script that (for example) enumerates your browser's history and ships it back using the XMLHTTPRequest object. The page does not need to use cookies, install special software like IE "browser helper objects" or need to expose itself through the use of hidden input tags. It's the greatest thing since sliced bread for spyware developers (multi-platform, lightweight, not yet easy to detect). I think javascript is generally better contained than, say, VBS, from a security standpoint, but I still have my concerns.
Worse yet, there isn't much in the way of user control--a person can disable Javascript entirely but then the whole app breaks. Browsers like Firefox can limit the use of javascript to do popo-up ads, alter toolbars and such, but I see nothing regarding security control of the XMLHTTPRequest object. As far as I can tell, if Javascript is enabled at all, a script can make full use of that object, and it'd be REALLY easy to use it to report my browsing history on a constant basis, without me knowing about it unless I do a lot of sleuthing in source files and cache.
In any case, I have some questions for "seasoned" AJAX coders (I am well-versed in Javascript but am a neophyte with ful-blown AJAX apps): What do you do to make sure your app is secure from client-side shenanigans (perhaps an AJAX-equivalent to SQL-injection), what can a user do to manage security within your AJAX app, and have you used AJAX techniques for potentially intrusive purposes (sniffing a client's environment in particular)? You can post anonymously if you've had to "do evil" as part of your job if you want
(BTW, a competent AJAX developer would at least take measures to disable the back button's functionality, and there are measures that can be taken to handle the back button gracefully. It is mostly a matter of sound design...)
Re:AJAX Privacy and Security? (Score:3, Informative)
The browser history is not available for security reasons. Off the top of my head, I don't remember if anything more than the screen resolution can be obtained. Really, you're not getting back anything useful. Just a lot of statistics that the Javascript uses to do its job.
Until the introduction of the XMLHTTPRequest object, develop
Re:AJAX Privacy and Security? (Score:3, Interesting)
I guess you are right about the history. However you can get more than just the resolution via Javascript. For example, you can still access the history in a limited fashion by using Javascript to create invisible tags with various URLs, then checking their "visited" property and using XMLHTTPRequest to send this back to your server. You can also
Re:AJAX? (Score:3, Informative)
Re:AJAX? (Score:4, Informative)
Anyway, thanks again.
Re:AJAX? (Score:2, Informative)
http://en.wikipedia.org/wiki/AJAX [wikipedia.org]
Re:AJAX? (Score:5, Funny)
Re:AJAX? (Score:5, Funny)
Re:AJAX? (Score:2, Informative)
Re:AJAX? (Score:2)
Re:AJAX? (Score:2, Funny)
Re:AJAX? (Score:3, Informative)
You'd be wrong. I don't believe slashdot uses any Javascript, except maybe some ad stuff. And even if it did, that's not a good definition. The point of Ajax is updating the client's display with new data from the server without reloading the entire page. This is why Ajax is so trendy - these pages are
Been there done that (Score:2)
It is simple really,
The attempt was to get a sleep function going because I wanted to load a very big picture but not have the user wonder why nothing was happening so I wanted to check if the image had loaded (img.complete) and if not display a loading message. Normally you would use a while loop with a sleep() call to just check every so often but javascript does not have such a funct
Re:Been there done that (Score:2)