| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <html> |
| <head> |
| <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>Apache Cocoon - Control Flow</title> |
| <link href="http://purl.org/DC/elements/1.0/" rel="schema.DC"> |
| <meta content="Ovidiu Predescu" name="DC.Creator"> |
| </head> |
| <body> |
| |
| <h1>Control Flow</h1> |
| |
| <p>Cocoon has advanced control flow, the ability to describe the |
| order of Web pages that have to be sent to the client, at any |
| given point in time in an application.</p> |
| |
| |
| <p>Traditional Web applications try to model the control flow of |
| a Web application by modeling the application as a finite state |
| machine (FSM). In this model, the Web application is composed of |
| multiple states, but the application can be only in one state at |
| a time. Any request received by the application transitions it |
| into a different state. During such a transition, the application |
| may perform various side-effects, such as updating objects |
| either in memory or in a database. Another important side-effect |
| of such a transition is that a Web page is sent back to the |
| client browser.</p> |
| |
| |
| <p>For simple Web applications, this model works fine. However, |
| as the application grows, the number of states and transitions |
| between them grows as well, and it becomes hard to visualize |
| what's happening in the application.</p> |
| |
| |
| <p>Moreover, the interactions in some applications are more |
| complex than a simple finite state machine. In such cases it's |
| much easier to think of and implement the application as a program, |
| rather than a FSM.</p> |
| |
| |
| <p>By using a high level programming concept called |
| <em>continuations</em>, Cocoon tries to solve this problem, and |
| promises to allow the control flow in Web applications to be |
| modeled as a normal program.</p> |
| |
| |
| |
| </body> |
| </html> |