From Ajax Patterns
|Revision as of 15:46, 3 August 2012
Thomasdelange (Talk | contribs)
← Previous diff
|Revision as of 21:01, 12 August 2012
22.214.171.124 (Talk | contribs)
Next diff →
|Line 33:||Line 33:|
|* '''Internet Access Required:''' The user can't access an Ajax application in the absence of a network connection.||* '''Internet Access Required:''' The user can't access an Ajax application in the absence of a network connection.|
|-||* '''Easily Abused:''' As with any powerful technology, Ajax concepts can be abused by careless programmers. The patterns on this site are intended to guide developers towards more usable solutions, but the fact remains that Ajax isn't always used in a manner that supports usability.||+||* '''Easily Abused:''' As with any powerful technology, Ajax concepts can be abused by careless programmers. The patterns on this site are intended to guide developers towards more usable solutions, but the fact remains that Ajax isn't always used in a manner that supports usability. [http://creditloanadvice.com/best-top-10-english-songs-2012-ten-latest-list-2011/ Top 10 songs]|
|''''''= Lifecycle of an Ajax Application =''''''||''''''= Lifecycle of an Ajax Application =''''''|
Revision as of 21:01, 12 August 2012
A Primer on the Ajax Phenomenon This is best for use in web applicationWith all the hype about "Ajax web applications", you could be forgiven for assuming Ajax is some radical new plugin, akin to Macromedia Flash. And you would therefore be under the impression that Ajax is out of bounds until you upgrade your "so last month" browser, or at least download the coveted "Ajax plugin".
Good news: You can run Ajax right now. At least, assuming you have a web browser from the past few years - IE, Firefox, Safari, or Opera. Have you seen Google Maps or perhaps GMail? They're both Ajax applications. So are Zuggest and the AjaxPatterns Wiki Demo .
What do they all have in common? All these applications take a great leap forth towards the richness of standard desktop applications. No longer are you forced to wait five seconds for the page to reload every time you click on something. Ajax applications change in real time. They can let you drag boxes around, they can refresh themselves with new information, they can completely re-arrange the page without clearing it.essay helpand iPad Apps Development And there's no special plugin required. Ajax is just a style of design, one that milks all the features of modern browsers to produce something that feels less web and more desktop.signals forex megadroid
Applications can act more like and be developed more like the days of Visual Basic, Delphi, PowerBuilder, C++ with GUI frameworks, etc. Thus, it is 90's GUI features but with a web browser: it strives to meld the best of web and the best of desktop GUI's. Web browser standards were originally designed for e-brochures only. Business forms and other needs were hacked into this e-brochure framework over time and it is clear that this after-thought retrofitting for different purposes has been ugly. Ajax attempts to remedy this.
Some of the characteristics of Ajax applications include:
- Continuous Feel: Traditional web applications force you to submit a form, wait a few seconds, watch the page redraw, and then add some more info. Forgot to enter the area code in a phone number? Start all over again. Sometimes, you feel like you're in the middle of a traffic jam: go 20 metres, stop a minute, go 20 metres, stop a minute ... How many E-Commerce sales have been lost because the user encountered one too many error message and gave up the battle? Ajax offers a smooth ride all the way. There's no page reloads here - you're just doing stuff and the browser is responding. The server is only telling the screen what changed rather than having it redraw the whole screen from scratch.
- Real-Time Updates: As part of the continuous feel, Ajax applications can update the page in real-time. Currently, news services on the web redraw the entire page at intervals, e.g. once every 15 minutes. In contrast, it's feasible for a browser running an Ajax application to poll the server every few seconds, so it's capable of updating any information directly on the parts of the page that need changing. The rest of the page is unaffected.
- Graphical Interaction: Flashy backdrops are abundant on the web, but the basic mode of interaction has nevertheless mimicked the 1970s-style form-based data entry systems. Ajax represents a transition into the world of GUI controls visible on present-day
- Language Neutrality - Ajax strives to be equally usable with all the popular languages rather than be tied to one language. Past GUI attempts such as VB, Tk, and Swing tended to be married to one specific programming language. Ajax has learned from the past and rejects this notion. To help facilitate this, XML is often used as a declarative interface language.
To prevent any confusion, these things are not characteristic of Ajax:
- Plugin-Based: Ajax applications do not require users to install browser plugins, or desktop software for that matter.
- Browser Specific: As long as the user is working with a relatively recent, mainstream, browser (say 2001+), the application should work roughly the same way. Browser-specific applications somewhat defeat the purpose of Ajax.
Downsides of Ajax?
Ajax is a trade-off. Any developer considering its adoption should be aware of the downsides, such as:
- Limited Capabilities: Some Ajax applications are certainly doing things people never dreamed were possible on the web, but there are still substantial restrictions of the web platform. For example: multimedia capabilities, local data storage, real-time graphics, interaction with hardware such as printers and webcams. Support for some of these are improving in recent browsers, some can be achieved by delegating to Flash, but many are simply not possible, and if required, would rule out Ajax.
- Performance Concerns: Constant interaction between browser and server can make an application feel unresponsive. There are, however, quite a few well-known patterns for performance optimization such as browser-side caching. These usually suffice, even for fast-paced applications like stock trading, but Ajax still might not work for really time-critical applications such as machine control.
- Internet Access Required: The user can't access an Ajax application in the absence of a network connection.
- Easily Abused: As with any powerful technology, Ajax concepts can be abused by careless programmers. The patterns on this site are intended to guide developers towards more usable solutions, but the fact remains that Ajax isn't always used in a manner that supports usability. Top 10 songs
'= Lifecycle of an Ajax Application =' The Ajax lifecycle is more like that of a traditional GUI than a traditional web application, with DOM objects acting like GUI widgets. The script registers event listeners on DOM objects, and manipulates the DOM in response to those events. As part of the event-processing cycle, the server may be invoked. There's actually a slight complication here in that the server calls are asynchronous, so the event-listening phase is split from the event-responding phase.
Here's a typical Ajax lifecycle within the browser:
- Visit: The user visits a site the usual way, i.e. by clicking on a link or typing a URL.
- Initialisation The page initially loads. Callbacks are established to handle user input, a loop might be established to continuously refresh page elements.
- Event Loop:
- Browser Event An event occurs, such as a keypress.
- Server Request The browser sends a request to the server.
- ...<Server processes the event>
- Server Response A moment later, the server responds, and the response is passed into a request callback function, one that was specified when the request was issued.
Of course, there are plenty of variants. In particular, many events are handled locally and don't actually trigger a trip to the server. Also, some Ajax applications are short-lived and the browser interaction is eventually terminated with the user submitting a form. Others remain to interact with the user as long as they are in the user's browser.
Note that the Browser Event and the Server Request occur in one thread, and the Server Response and Browser Update occur in a separate thread. This is due to the asynchronous nature of the server request. It's actually possible to configure XMLHttpRequest to make synchronous calls, but poor practice as it holds up the user.
Want to Learn More?
So you want to get started on Ajax? Here are some pointers:
- Ajax Patterns is a collection of design patterns advising on usability and technical implementation of Ajax applications.