The Model-View-Controller. is an application building pattern which makes it easier for developers to separate application concerns - namely: presentation and businness logic. This separation is good for understanding and maintaining the code. MVC is already a quite old and mature concept, comes from Smalltalk developers and is extensively used in client GUI Java APIs like Swing and SWT. The web application frameworks have adapted this pattern and implemented it in many different ways providing different levels of flexibility.
TODO: The main idea of web application frameworks which support MVC pattern is to move away all the logic contained in presentation layer - most often some kind of templates, ObjectLedge uses Velocity - to avoid problems when changing the way data is presented or changing the way business logic works.
ObjectLedge MVC implementation is based on ideas from Jakarta Turbine project. It uses a number of dedicated Valve components inserted into a Pipeline component embedded in LedgeServlet. Together with the Pipeline and Selector components, valves create a Controller part of a MVC framework. The most important valves are:
The ActionExecutorValve executes actions. Actions are components which when
executed are expected to make changes in Model part of MVC architecture. For example an
update of address data in the phone book database is an action.
The BuilderExecutorValve executes builders, a View part of MVC architecture.
Views are not expected to make changes in Model. The role of View is
to present data and UI controls to the application user. For example a view is a list of
address entries in an address database together with buttons which allow editing entries
and viewing their details. The view itself does not change database contents but exposes GUI
for executing such actions. The other example is a view with a form for address entry editing.
This form may be connected with entry update action as described above.
The following subsections describe more concepts of ObjectLedge MVC implementation.
The page model of ObjectLedge MVC web application allows developers to build web pages (Views) with a great flexibility in layout construction and ability to reuse page components. The understanding of page model concept is crucial for web application development using ObjectLedge.
Finder is a component which performs automated Builder (View), template and Action lookup. It provides a defaulting strategy for finding missing elements and performs operations needed to enclose Builders in one another, thus allowing complex layouts construction.
Builders are base elements for page construction. They are used to display main part of the page (in Turbine called Screen) and construct multi-level layouts. Builders may also be used as binary data serving elements.
Components are additional parts of the page which may be reused and are embedded in the page on template level.