Your SlideShare is downloading. ×
0
Presentation Slides
Presentation Slides
Presentation Slides
Presentation Slides
Presentation Slides
Presentation Slides
Presentation Slides
Presentation Slides
Presentation Slides
Presentation Slides
Presentation Slides
Presentation Slides
Presentation Slides
Presentation Slides
Presentation Slides
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Presentation Slides

248

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
248
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. AJAX Patterns <ul><li>Web 2.0 and Rich Internet Applications </li></ul><ul><li>Dr. Suthikshn Kumar </li></ul>
  • 2. AJAX Patterns <ul><li>Only Algorithms ( No Examples !) </li></ul><ul><li>Predictive Fetch </li></ul><ul><li>Submission Throttling </li></ul><ul><li>Periodic Refresh </li></ul><ul><li>Multistage Download </li></ul><ul><li>Fall back Patterns </li></ul>
  • 3. Design Patterns <ul><li>Describe programming techniques to solve common problems. </li></ul><ul><li>Design patterns are not standards to be followed, merely designs of solutions that have worked previously. </li></ul><ul><li>Collective Wisdom </li></ul><ul><li>Design patterns cut development time. </li></ul><ul><li>Many problems we face everyday may already have been solved by someone else. </li></ul><ul><li>That is where design patterns are useful. </li></ul>
  • 4. Design Patterns <ul><li>In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. </li></ul><ul><li>A design pattern is not a finished design that can be transformed directly into code. </li></ul><ul><li>It is a description or template for how to solve a problem that can be used in many different situations. </li></ul><ul><li>Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. </li></ul><ul><li>Algorithms are not thought of as design patterns, since they solve computational problems rather than design problems. </li></ul><ul><li>Design patterns are for avoiding “Reinventing Wheels” </li></ul>
  • 5. AJAX Patterns <ul><li>Ajax has been around since 2005. </li></ul><ul><li>Communication Patterns: </li></ul><ul><ul><li>Hidden Frame techniques </li></ul></ul><ul><ul><li>Aynchronous XMLHttp calls </li></ul></ul>
  • 6. Predictive Fetch <ul><li>Predicting what the user will do next </li></ul><ul><li>Fetch on Demand </li></ul><ul><li>Predictive Fetch pattern is relatively simple idea, somewhat difficult to implement. </li></ul><ul><li>Ajax application guesses what the user is going to do next and retrieves the appropriate data. </li></ul><ul><li>Determining future user action is just guessing game depending on his intentions. </li></ul>
  • 7. Predictive Fetch <ul><li>Suppose the user is reading an online article that is separated into 3 pages. </li></ul><ul><li>It is logical to assume that if the user is interested in reading the first page, sure he/she will also be interested in second and third page. </li></ul><ul><li>So if the first page has been loaded for few seconds, it is probably safe to download the second page in the background. </li></ul><ul><li>This can be easily determined by using a timeout. </li></ul>
  • 8. Submission Throttling <ul><li>Sending data to the server issue </li></ul><ul><li>In traditional web application, each clik makes a request back to the server. </li></ul><ul><li>In the Ajax model, the user interacts with the site or application without additional requests being generated for each clik. </li></ul><ul><li>In traditional web application, data is sent to the server every time a user action occurs. Thus when the user types a letter, that letter is sent to the server immediately. </li></ul><ul><li>The process is repeated for each letter typed. </li></ul><ul><li>The Submission Throttling, design pattern is an alternative approach. </li></ul><ul><li>Using submission throttling, you buffer the data to be sent to the server on the client and send the data at predetermined times. </li></ul><ul><li>Example: Google Suggest </li></ul>
  • 9. Submission Throttling Collect data Send data Done Is the user idle? Is it time to send data ? Contine Collecting Data NO NO Yes Yes NO Yes
  • 10. Submission Throttling <ul><li>Incremental Form Validation </li></ul><ul><ul><ul><li>OnChange </li></ul></ul></ul><ul><ul><ul><li>ValidateField </li></ul></ul></ul><ul><ul><li>Incremental Field Validation </li></ul></ul>
  • 11. Periodic Refresh <ul><li>This pattern describes the processof checking for new server information in specific Intervals. </li></ul><ul><li>This approach is also called as polling </li></ul><ul><li>The pattern is used in updating the sports score. Online scoreboards are updated online. </li></ul><ul><li>Gmail uses periodic refresh to notify users when new email has been received. </li></ul>
  • 12. Multi-Stage Download <ul><li>Web designers are loading their pages with multimedia, pictures, graphics, content etc. While this gives more information, also leads to slower download times as everything is loaded in seemingly random order. </li></ul><ul><li>Multi-stage download is an ajax pattern wherin only the most basic functionality is loaded into a page initially. </li></ul><ul><li>Upon completion, the page then begins to download other componentson the page. </li></ul><ul><li>If the user stays on the page for extended period of time, the extra functionality is loaded in the background and available when the user is ready. </li></ul><ul><li>The major advantage here is that you, as the developer, get to decide what is downloaded and at what point in time. </li></ul><ul><li>Example Start.com from Nicrosoft. </li></ul><ul><li>Graceful degradation in case the browser don’t support Ajax. </li></ul>
  • 13. Fallback Patterns <ul><li>If there is an error on the server? </li></ul><ul><li>Or the request never makes it to the server? </li></ul><ul><li>Ajax applications plan ahead for these problems and describe how your application should work if one these should occur. </li></ul><ul><ul><li>Cancel Pending request ( status other than 200) </li></ul></ul><ul><ul><li>Try Again </li></ul></ul>
  • 14. Fallback Patterns <ul><li>Whatever can go wrong will go wrong, and at the worst possible time, in the worst possible way – Murphy’ law. </li></ul>
  • 15. AJAX Patterns <ul><li>Even though the term Ajax has been around only since early 2005, the techniques that Ajax describes have been used since the late 1990s, giving rise to several Ajax patterns that solve specific problems. </li></ul><ul><li>Hidden Frame technique and Asynchronous XMLHttp calls are Communication Patterns between client and server using JavaScript. </li></ul>

×