spacer
Web Development Tutorials JAVA Tutorials
 Developer Newsletter

Tutorials
AJAX
ASP
CGI & Perl
CSS
Flash
HTML
Illustrator
Java
JavaScript
Linux
MySQL
PHP
Photoshop
Python
Wireless
XML
Miscellaneous


Scripts Directory
AJAX Scripts
ASP Scripts
ASP.NET Scripts
CGI & Perl Scripts
Flash Scripts
Java Scripts
JavaScript Scripts
PHP Scripts
Python Scripts
Remotely Hosted Scripts
Tools & Utilities Scripts
XML Scripts

Web Hosting Directory
ASP.NET
Budget
Dedicated Servers
Ecommerce
Linux
Resellers
Shared
Small Business
Windows

Developer Manuals
Learn HTML
Learn PHP
Learn CSS
Learn AJAX
Learn JavaScript
Learn Pear
Free White Papers

Developer Resources
Developer Tools
Developer Content
Survey Software
Dedicated Servers




Use Continuations to Develop Complex Web Applications

By Abhijit Belapurkar
2005-04-22


A Programming Paradigm to Simplify MVC for the Web

If you've ever developed a non-trivial Web application, you know that development complexity is increased by the fact that Web browsers allow users to follow arbitrary navigation paths through the application. No matter where the user navigates, the onus is on you, the developer, to keep track of the possible interactions and ensure that your application works correctly. While the traditional MVC approach does allow you to handle these cases, there are other options available to help resolve application complexity. Developer and frequent developerWorks contributor Abhijit Belapurkar walks you through a continuations-based alternative that could simplify your Web application development efforts.

Due to the inherent stateless nature of HTTP, Web technologies suffer from the problem of state information being forgotten between two successive user interactions. An interactive Web application consists of a collection of scripts wherein a single interaction comprises one script delivering a page to the browser (then ending), the user completing and submitting the form at some later point in time, and another (possibly different) script handling the submitted form. Thus, application logic is spread across a multitude of scripts.

Matters are further complicated by the fact that browsers allow users to backtrack in their interactions or clone an in-progress interaction and run both in parallel. Given this set of possibilities, a user can pursue multiple navigational paths within an application at any given time, and it's up to you to write code to ensure that each outcome is successful. Web development frameworks, such as Spring and Struts, allow you to handle multiple navigational paths, but they do so at the cost of increasing the complexity of an already overly complex code base.

In this article, I'll introduce a continuations-based alternative that can simplify the development of complex Web applications. I'll start with an introduction to continuations, including an argument for how the continuations-based approach can be a shot in the arm for the traditional MVC style of programming. Then I'll move on to a simple example: an enterprise application that demonstrates the advantages of using continuations in terms of ease of development and understanding of the application code. Because one of the chief disadvantages of using continuations is their lack of support on the Java platform, I'll use the Apache Cocoon framework to demonstrate a JavaScript implementation of the example program and a pure Java language one. I'll conclude with an overview of the pros and cons of using continuations.

Select the Codeicon at the top or bottom of this article to download the example application source code. See Resources to download the Apache Cocoon framework, which you will need to run the example.

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 Print |   Write For Us
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



About the NetVisits, Inc Network | Write For Us | Advertise
Copyright ©2007 NetVisits, Inc Network. All Rights Reserved. Privacy Policy.
Visit other NetVisits, Inc. sites: