From Ajax Patterns
|Revision as of 19:41, 11 January 2008
18.104.22.168 (Talk | contribs)
convert to wiki format (whew! that was a lot of work!)
← Previous diff
|Revision as of 09:52, 5 August 2008
22.214.171.124 (Talk | contribs)
Next diff →
|Line 91:||Line 91:|
|== Conventional Web App ==||== Conventional Web App ==|
|-||Over conventional web apps, Ajax has the following advantages:||+||[http://proxysurf.sarki-sozlerin.com proxy surf]|
|-||* Less waiting time, which makes users more productive and less frustrated.||+||[http://proxysurf.sarki-sozlerin.com proxy]|
|-||* The browser can be kept up-to-date without the user having to keep hitting refresh.||+||[http://www.sarki-sozlerin.com müzik dinle]|
|-||* Superior widgets make input more expressive.||+||[http://www.harbioyun.com Oyun]|
|-||* Visual effects and dynamic browser activity make the application feel more alive, and give users a better feeling of control.||+||[http://www.harbioyunlar.com/18oyun-9-oyunlar.htm Oyunlar]|
|-||+||[http://www.harbioyunlar.com/18oyun-14-kral_oyun.htm Kral Oyun]|
|-||Conventional web apps do have some advantages:||+||[http://www.harbioyunlar.com/18oyun-1-bedava_oyun.htm Bedava Oyun]|
|-||* Users are more familiar with conventional apps.||+||[http://www.harbioyunlar.com/18oyun-1-online_oyun.htm Online Oyunlar]|
|-||* Developers don't need to learn new techniques.||+||[http://www.harbioyunlar.com/18oyun-1-18_oyun.htm +18 Oyunlar]|
|-||* Compatible with older and non-standard browsers.||+||[http://www.harbioyunlar.com/18oyun-7-Oyun_oyna.htm Oyun Oyna]|
|-||== Flash App ==||+|
|-||As the Solution pointed out, a standard web app that uses some Flash here and there can still be considered an Ajax App. Here, though, we're comparing Ajax to full-blown Flash, the kind of applications that won't do anything unless Flash is enabled.||+|
|-||Flash and Ajax are actually a close match. [http://maps.google.com Google Maps] caused surprise when it came out, as many assumed that only Flash could produce something as rich inside the browser. Yahoo! then turned it full circle by producing a similar product, [http://maps.yahoo.com/ Yahoo! Maps], in Flash. Despite the similarities, significant differences do remain.||+|
|-||Compared to Flash, Ajax has the following benefits:||+|
|-||* Ajax is more portable as it runs on any standard browser, although Flash support is still quite widespread.||+|
|-||* Ajax Apps will often be more consistent, using standard web conventions familiar to most users. Flash has less established conventions, so using an app is somewhat less predictable.||+|
|-||* Ajax works better with non-browser clients such as search engine robots.||+|
|-||* Ajax plays nicer with browser settings such as colour preferences, and also with browser-specific features, e.g. skins, auto-completion and Greasemonkey-style enhancements.||+|
|-||* Ajax is safer long-term as there's no lock-in to a proprietary plugin.||+|
|-||* Due to its open nature, the community of Ajax developers is growing rapidly, so that libraries, techniques, and *cough* patterns are evolving rapidly.||+|
|-||Following are the benefits of Flash over Ajax. Whether these are compelling enough to write a pure Flash app depends on the circumstances; keep in mind that the most appropriate solution is often a combination of Flash and Ajax when it's not possible to stick with pure Ajax.||+|
|-||* Flash offers richer graphics and video.||+|
|-||* Flash allows for sound effects and playback of sound files, as well as audio input.||+|
|-||* Rich graphical programming may be easier in Flash because, unlike Ajax, it's designed with those kind of applications in mind.||+|
|-||* Flash allows for local storage.||+|
|-||== Java Applets ==||+|
|-||For some Java developers, Ajax is deja vu. In the mid-to-late '90s, Java applets were destined to take over the browser and turn the desktop into a trivial sideshow. It didn't happen for various reasons, and Java applets are now rarely seen on the web. Still, they persist in the enterprise, and as with Flash, it's possible to combine the technologies. Some have speculated that all the interest in Ajax might breathe some life into the world of applets; it doesn't seem to be the case so far, but it's too early to be sure.||+|
|-||Ajax has several advantages over Java applets:||+|
|-||* Ajax apps load in a matter of seconds, where Java applets tend to take longer because they tend to use larger libraries, and have to load them all to get started.||+|
|-||* Ajax apps look and feel like standard web apps, while Java applets feel more like desktop apps and somewhat out of place in the browser.||+|
|-||* Ajax features can grow organically from a conventional web app, whereas Java uses a completely different programming style that has to be written from scratch.||+|
|-||* Java versions have changed over the years, and there are often incompatibilities between an applet and the Java environment used by the browser. Furthermore, you usually have to lag a few years behind the most recent version of Java.||+|
|-||Java applets have several advantages over Ajax:||+|
|-||* Java is often used on the server-side, so there are synergies in a 100% Java solution, such as shared code and the ease with which developers can transcend tiers.||+|
|-||* Many people know Java already, and an applet architecture means they virtually don't have to know anything at all about web technologies.||+|
|-||* There is good support for desktop-like user-interfaces, if that's what is desired.||+|
|-||Sun has more recently introduced Java Web Start as a cross between the desktop and the browser. Web Start apps run off the desktop, but can be launched by activating a URL in the browser. The huge waiting times of applets are avoided because libraries can be held locally and shared across applications. It's a useful alternative to applets, more geared toward the enterprise, though it also hasn't taken off in a big way.||+|
|-||== Desktop App ==||+|
|-||There has always been a decision to make between the desktop and the web. Ajax ramps up the web argument, with even mainstays of the desktop, like word processors and spreadsheets, becoming commonplace in the browser. Microsoft's "Live" strategy, which involves Ajaxified versions of its Office apps, is a major case in point. Still, other applications like games and multimedia tools won't be budging from the desktop for a long time to come.||+|
|-||Ajax offers the following advantages over the desktop:||+|
|-||* An Ajax App doesn't need to be installed; it's available on any computer with a browser. Thus, it suits people who use multiple computers and people who use computers which they can't control.||+|
|-||* Ajax data is hosted on the network, so users can access it from anywhere, and it can be backed up automatically. While this is feasible with desktop apps too, it doesn't tend to happen that way for several reasons, e.g. data migration would be difficult because there are so many different desktop versions running at the same time.||+|
|-||* Most users are comfortable with web interaction mechanisms, and well-designed Ajax Apps exploit that familiarity.||+|
|-||* Ajax works well with the web. Users can bookmark a "position" within an Ajax App, click on a hyperlink within the Ajax App, and so on.||+|
|-||* Ajax Apps are upgraded with no user intervention.||+|
|-||* Developers can choose the server-side programming and runtime environment according to their own needs, whereas desktop apps impose many constraints.||+|
|-||Ajax has bridged the gap, but desktop apps can still do many things that are beyond the realm of standard web browsers (See also [[Richer Plugin]]):||+|
|-||* Local file access||+|
|-||* Sound, taking full advantage of modern sound cards.||+|
|-||* Rich graphics, taking full advantage of modern video cards.||+|
|-||* Keyboard shortcuts, where support is varied in the browser.||+|
|-||* Hardware access.||+|
|-||* Communication to machines other than the base server, and in protocols other than HTTP.||+|
|-||* OS-specific interaction, such as popping up alerts.||+|
|-||== Mobile App ==||+|
|-||With mobile apps growing in parallel with Ajax, it's worth considering them as an alternative, albeit a less direct one. As it happens, Ajax itself may actually become a good platform for mobile apps, with [http://www.opera.com/products/mobile/platform/ Opera] now providing Ajax support on their mobile platform.||+|
|-||<!-- =================================================================== -->||+|
|= Related Patterns =||= Related Patterns =|
Revision as of 09:52, 5 August 2008
Tags: Ajax, Balanced, Client-SOA, DHTML, Fast, Fat, Interactive, Platform, RichInternetApplication, Rich, Thick, Web2.0, WebApp
Pam's begun entering staff appraisals into a new Ajax App. She's pleased to see the data entry is much faster: fields are validated as soon as they're filled out, searches are integrated into the form rather than in annoying popups, and the remaining form fields keep mutating to reflect what she's entered so far.
How can you create a rich application?
See the first chapter, Chapter 1, for more details on the forces driving Ajax.
- Users like working and playing in the browser and are now more willing to keep their data online, but are nonetheless frustrated with conventional "click'n'wait" interfaces.
- Companies like web apps running on their intranets because it makes deployment much easier, but continue to be burned by unusable web apps that don't deliver the same value as a comparable desktop app.
- Developers are now well-versed in the basic patterns of web architecture, and ready to take on new challenges.
- Technology has opened up new opportunities for the web: broadband and beyond is becoming ubiquitous in many countries; servers can process huge quantities of requests per second; storage is growing to the point where it's feasible for individuals to host most of their personal data online.
Produce an Ajax App - a rich application capable of running inside any modern web browser. The user fires up an Ajax App by typing in a URL, clicking a link, or activating a bookmark. The Ajax App is then downloaded into the browser and the user can begin working with it immediately.
Ajax is fundamentally a user-centered pattern. As mentioned in the first chapter, the major force driving Ajax is the needs of users and their organizations to get more out of the web. For too long, people have endured pages that take forever to load, widgets that make no sense, forms that conveniently "forget" their data when they take too long to fill out. There are good reasons for people to continue using a browser, as noted in Chapter 1, but it's in the interests of website owners and employers to do a better job at making that interaction productive and enjoyable.
Ajax aims to improve user experience within the constraint of respecting browser standards. Standard-based design obviously has the benefit of portability, but also has a usability component in itself; users interact with hundreds of websites, and appreciate consistency, a quality that quickly erodes when you rely on plugins, browser-specific features, and "creative" design ideas. Sure, incorporate a novel widget or a funky layout when it works, but for most things, the standard ways works best.
Non-standard technologies also break consistency; one reason Flickr began migrating from Flash to Ajax was because users want to right-click to save images, a standard broken by Flash. Again, don't be afraid to use a technology like Flash to achieve something standard browsers won't do - that's the whole idea behind the Richer Plugin pattern. Some people will say it's not an Ajax App if it uses Flash, but the definition here would include a mostly-Ajax App that delegates to Flash (or other plugins) to fulfill some specialised task. In any event, the definition really isn't worth arguing about (after all, you can define "Ajax" however you like); the important thing is to ask what helps users - sometimes, it's better to incorporate some Flash or Java, other times a desktop solution really is the best approach.
Will your application be "Ajax Deluxe" or "Ajax Lite"?
There are two archetypal architectures for Ajax, and all applications lie somewhere along the spectrum between these extremities:
- Ajax Deluxe
- Ajax Deluxe uses Ajax to the max: applications feel similar to a desktop in that the browser is driving the interaction - it mediates all interaction between the user and server, so there are no - or few - direct page refreshes. Similarly, there's no need for session tracking in the server, because in the absence of page refreshes, all relevant state can be retained inside the browser script. The server need not know about HTML at all, and might just offer generic Web Services. An example is the Ajax calendar, Kiko.
- Ajax Lite
- An Ajax Lite App feels more like a conventional web app overall, but one that's been sprinkled with Ajax here and there. For instance, Ajax might be used to validate a form before it's submitted using standard form submission, or to reveal some instructions on the page when a user requests help. An example is Delicious, which works fine on legacy browsers, but offers Ajax Suggestions for the many browsers that support it.
Which will you use? The Deluxe approach suits a development team with more advanced web programming knowledge and access to relevant tools and cross-browser libraries, and will generally lead to a nicer, more effective, user-interface. It also facilitates a well-partitioned architecture, since the presentation logic can be completely isolated inside the browser and the business logic completely isolated in the server. However, Deluxe applications may place a strain on the browser and network capabilities, and might not even be possible if the browser is outdated. Ajax Lite is a better answer for older browsers, since the Ajax features can usually be "turned off" to support graceful degradation.
What browser requirements will there be to run your Ajax App?
One of the reasons why Ajax has taken off now, in spite of people having tried similar things earlier on, is that browsers are now more consistent. For an Ajax app, you'll need to decide which browsers you're targeting and which browsers just aren't worth the effort. XMLHttpRequest is the main constraint, because it usually appeared later in a browser's feature set than other foundational technologies. Roughly, we're looking at browsers from around 2001 onwards. A [typical guideline is: Internet Explorer 5+ for Windows, Firefox 1+, Mozilla 1+, Safari 1.2+, Opera 7.6+. Other browsers such as Netscape and Konqueror might be considered too. Whether you'll support all these browsers, or just a subset, depends on how important the diversity is, how much expertise or library support you have, and how much time you can devote to testing.
How will you treat browsers with insufficient technologies for Ajax?
Building on the previous point, what happens when your application requires features not provided by the browser being used. As explained in Cross-Browser Component, you can either check for specific features or you can check browser versions. If you do the former, you have the opportunity for graceful degradation - to cut out one specific feature, or provide a simpler alternative. It's more work, but lets you support more users. The alternative is to give up and suggest the user upgrade browser, sometimes the only thing you can reasonably do.
How much processing power will be required of the browser?
== How much networking capacity will be required?
With Ajax Apps, there are two networking factors to consider:
- Throughput (Bandwidth)
- How much data can be transferred per second?
- How much time between a packet leaving the browser and arriving at the server? (Or vice-versa.)
In some cases, Ajax actually reduces throughput requirements by avoiding full page refresh. Yet, it's still important to consider, because there can still be a strain caused by patterns like Periodic Refresh, which continuously pulls down new data. When you consider that some Ajax features (e.g. Live Search) require round trips to the server on just about every keystroke, you can see why latency is becoming a growing theme in web design. For smaller packets, which are common in Ajax Apps, >latency is actually a much greater source of delay than throughput, especially across long distances. Again, it comes down to benchmarking and deciding what's feasible. If a round trip takes several hundred milliseconds, responding to each keystroke will probably cause more frustration than joy.
Please refer to the examples in Chapter 1.
Please refer to the code examples in ???.
Conventional Web App
All of the patterns in this language relate in some way to Ajax. In particular, the Solution above points to the foundational technology patterns that really define what Ajax is all about.
 Harry Fuecks explains essentially the same distinction as "Client/SOA" versus "HTTP++". Likewise, Craig Shoemaker contrasts "Ajax Applications" with "Ajax Websites".