| <?xml version="1.0" encoding="UTF-8"?> |
| <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd"> |
| |
| <document> |
| <header> |
| <title>Apache Cocoon - Control Flow</title> |
| <authors> |
| <person name="Ovidiu Predescu" email="ovidiu@apache.org"/> |
| </authors> |
| </header> |
| <body> |
| <s1 title="Control Flow"> |
| <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> |
| |
| </s1> |
| </body> |
| </document> |