cocoon的文檔中有這樣一段話:
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.
當web應用程序逐漸變的復雜起來,這個最簡單的FSM模型就顯得力不從心了。因此發展出了MVC模型(Model-View-Controller), 這是對有限狀態機的一個精細化。首先我們識別出session,request中的變量之間存在相關性,而且變量之間的地位也是不平等的,某些變量的改變 將直接導致另外一些變量的改變。因此變量根據相關性被聚合起來,構成很多對象。應用程序的狀態不再由一個個獨立的變量構成,而是由具有更豐富語義的對象構 成。在大的結構方面,一些基本的對象被分離出來,構成一個核心,即model層, 而外圍的變量被分割在不同的view中。 在流行的struts和webwork等MVC框架中,變量的聚合都定義在action層, 各個相關的action并沒有匯聚成一個具有獨立意義的對象,似乎僅僅做到了model層和view層的分離,在model層內部并沒有建立合適的模型, 即struts和webwork等建立的MVC模型中隱含假定整個model層內部是沒有結構的(注,我對struts和webwork的了解限于簡單介 紹文檔,這里的說法可能并不準確)。一些更加精細的MVC架構直接支持model層的分解,即model層由一系列不相關的對象構成,每個對象具有從屬于 自己的action。沿著這個復雜性發展的級列繼續下去,我們可以知道,當對象之間的交互變得更加復雜的時候,我們需要框架本身能夠直接支持model層 對象之間的相關性。最簡單的控制關系是樹形結構,即父節點控制子節點,父節點銷毀的時候子節點自動銷毀。這樣就構成所謂的HMVC (Hierarchical MVC)模型。在這個模型中,model層由一系列的對象組成,而且這些對象被分割到不同的package中,組成一個樹形結構.