Helping ordinary people create extraordinary websites!
GET OUR NEWSLETTER
Your Email:
 

Use Continuations to Develop Complex Web Applications

By Abhijit Belapurkar
2005-04-22


You Make the Rules!

While it is possible to implement continuations as a simpler alternative to MVC frameworks, this style of programming does offer some distinct advantages, particularly when it comes to controlling application behavior. For example, frameworks supporting continuations typically allow for invalidating a particular one. Invalidating a continuation makes it impossible to go back to the page corresponding to that continuation (by clicking on the browser's Back button, for instance) and change the associated form data before re-submitting the form. (Internally, the server deletes the continuation object corresponding to the continuation id. As a result, there is no continuation available to resume, and an error is reported. This error can be handled -- in a manner specific to the development framework being used -- by redirecting the browser to an error page, for example. Ruling out this type of action in some instances offers a much greater degree of control over your application's processing overhead. As previously discussed, it is also possible to employ scripting code in an MVC framework to disallow certain navigational patterns. Continuations just let you do so more easily.

Unlike MVC implementations, the continuations-based approach provides a workaround to the code tangle that can result from trying to handle cloning. In the continuations-based approach, the user can enter different data on the original and the cloned windows, and submit both in parallel. The continuation is then resumed in two threads (basically, the server threads that have been assigned the handling of the two requests) with two sets of submitted values. This outcome is far preferable to what commonly happens in Web applications not based in continuations: Either such a feature is disallowed or one transaction overrides the other. Disallowing this feature is not always a good option, because users sometimes use the browser cloning feature to do what-if analyses on two sets of values prior to choosing one.

It's also worth noting that the continuations-based approach does away with the concept of user state. With continuations, a user can have multiple states at the same time, one for each cloned page open in a browser window.

Tutorial Pages:
» A Programming Paradigm to Simplify MVC for the Web
» What is a Continuation, Anyway?
» Problems in Conventional Web development
» The Case for Continuations
» User-Centered Navigation
» You Make the Rules!
» The Continuations Repository
» An Example Application
» Web Continuations in Apache Cocoon
» The Application Sitemap
» The Application Logic
» Understanding the Application Logic
» Resuming the Continuation
» JavaScript vs. the Java language
» Continuations in Java code
» Pros and Cons of Continuations
» Conclusion
» Resources


First published by IBM DeveloperWorks


 | Bookmark
Related Tutorials:
» All about JAXP, Part 1
» Make Database Queries Without the Database
» Load List Values for Improved Efficiency
» 2 Ways To Implement Session Tracking
» A Simple Way to Read an XML File in Java
» Develop Aspect-Oriented Java Applications with Eclipse and AJDT

Advertise with Us!


Tutorials Scripts Web Hosting Developer Manuals
Resources