| <!DOCTYPE html> |
| |
| |
| <!-- |
| | Generated by Apache Maven Doxia Site Renderer 2.0.0 from src/site/xdoc/further-reading/pullmodel.xml at 17 Jun 2025 |
| | Rendered using Apache Maven Fluido Skin 2.1.0 |
| --> |
| <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> |
| <head> |
| <meta charset="UTF-8" /> |
| <meta name="viewport" content="width=device-width, initial-scale=1" /> |
| <meta name="generator" content="Apache Maven Doxia Site Renderer 2.0.0" /> |
| <title>Pull vs. Push – Apache Turbine</title> |
| <link rel="stylesheet" href="../css/apache-maven-fluido-2.1.0.min.css" /> |
| <link rel="stylesheet" href="../css/site.css" /> |
| <link rel="stylesheet" href="../css/print.css" media="print" /> |
| <script src="../js/apache-maven-fluido-2.1.0.min.js"></script> |
| <style>.github-fork-ribbon:before { background-color: orange; }</style> |
| </head> |
| <body> |
| <a class="github-fork-ribbon right-top" href="https://github.com/apache/turbine-site" data-ribbon="Fork me on GitHub">Fork me on GitHub</a> |
| <div class="container-fluid container-fluid-top"> |
| <header> |
| <div id="banner"> |
| <div class="pull-left"><div id="bannerLeft"><h1><a href=".././"><img src="../images/turbine-project.png" alt="Apache Turbine" /></a></h1></div></div> |
| <div class="pull-right"><div id="bannerRight"><h1><a href=".././"><img src="../images/logo.gif" /></a></h1></div></div> |
| <div class="clear"><hr/></div> |
| </div> |
| |
| <div id="breadcrumbs"> |
| <ul class="breadcrumb"> |
| <li id="publishDate">Last Published: 01 Apr 2025<span class="divider">|</span> |
| </li> |
| <li id="projectVersion">Version: 7.0</li> |
| <li class="pull-right"><span class="divider">|</span> |
| <a href="../fulcrum/">Fulcrum</a></li> |
| <li class="pull-right"><span class="divider">|</span> |
| <a href=".././">Turbine</a></li> |
| <li class="pull-right"><span class="divider">|</span> |
| <a href="https://www.apache.org/">Apache</a></li> |
| <li class="pull-right"><span class="divider">|</span> |
| <a href="../fulcrum/">Fulcrum</a></li> |
| <li class="pull-right"><a href="https://www.apache.org">Apache</a></li> |
| </ul> |
| </div> |
| </header> |
| <div class="row-fluid"> |
| <header id="leftColumn" class="span2"> |
| <nav class="well sidebar-nav"> |
| <ul class="nav nav-list"> |
| <li class="nav-header">General Information</li> |
| <li><a href="../index.html">Overview</a></li> |
| <li><a href="../turbine-concepts.html">Turbine Concepts</a></li> |
| <li><a href="../fsd.html">Specification</a></li> |
| <li><a href="../further-reading/index.html">Further Reading</a></li> |
| <li><a href="../news.html">News and Status</a></li> |
| <li><a href="../common/powered.html">Sites Using Turbine</a></li> |
| <li><a href="../common/related.html">Sites Related to Turbine</a></li> |
| <li><a href="../common/license.html">License</a></li> |
| <li><a href="../download.html">Download</a></li> |
| <li><a href="../examples.html">Example Apps</a></li> |
| <li class="nav-header">Shortcuts to Turbine Documentation</li> |
| <li><a href="https://blogs.apache.org/turbine/">Turbine Blog</a></li> |
| <li><a href="https://cwiki.apache.org/confluence/display/TURBINE/">Turbine Wiki Home</a></li> |
| <li><a href="https://cwiki.apache.org/confluence/display/TURBINE/Turbine2+FAQ">Frequently Asked Questions (FAQ)</a></li> |
| <li><a href="https://cwiki.apache.org/confluence/display/TURBINE/Turbine2+Tutorial">Tutorial</a></li> |
| <li><a href="https://cwiki.apache.org/confluence/display/TURBINE/Turbine2+UsersGuide">User's Guide</a></li> |
| <li><a href="https://cwiki.apache.org/confluence/display/TURBINE/Turbine5">Development</a></li> |
| <li class="nav-header">Events</li> |
| <li><a href="https://www.apache.org/events/current-event.html" target="_blank"><img class="imageLink" src="https://www.apache.org/events/current-event-125x125.png" /> Apache Conferences</a></li> |
| <li class="nav-header">Turbine Releases</li> |
| <li><a href="../turbine/index.html">Overview</a></li> |
| <li><a href="../turbine/turbine-2-3-3/index.html">Turbine 2.3.3</a></li> |
| <li><a href="../turbine/turbine-4-0/index.html">Turbine 4.0 (M2)</a></li> |
| <li><a href="../turbine/turbine-5-0/index.html">Turbine 5.0</a></li> |
| <li><a href="../turbine/turbine-5-1/index.html">Turbine 5.1</a></li> |
| <li><a href="../turbine/turbine-6-0/index.html">Turbine 6.0</a></li> |
| <li><a href="../turbine/turbine-7-0/index.html">Turbine 7.0</a></li> |
| <li class="nav-header">Turbine Development</li> |
| <li><a href="../turbine/index.html">Current Turbine Development Tree</a></li> |
| <li class="nav-header">Turbine Sub Projects</li> |
| <li><a href="../fulcrum/index.html">Fulcrum</a></li> |
| <li class="nav-header">Turbine + Fulcrum Parent POM</li> |
| <li><a href="../turbine-parent/index.html">Turbine Parent</a></li> |
| <li class="nav-header">Closed projects</li> |
| <li><a href="../stratum/index.html">Stratum</a></li> |
| <li><a href="../tdk/index.html">TDK</a></li> |
| <li><a href="../meta/index.html">META</a></li> |
| <li class="nav-header">Community</li> |
| <li><a href="../who-we-are.html">Who we are</a></li> |
| <li><a href="../contact.html">Contact us</a></li> |
| <li><a href="../how-to-help.html">How to help</a></li> |
| <li><a href="../how-it-works.html">How it works</a></li> |
| <li><a href="../board-reports.html">Board reports</a></li> |
| <li class="nav-header">General Development Information</li> |
| <li><a href="../common/code-standards.html">Coding Specification</a></li> |
| <li><a href="../common/developer-links.html">Developer Links</a></li> |
| <li><a href="../common/documentation.html">Improving Documentation</a></li> |
| <li class="nav-header">ASF</li> |
| <li><a href="https://apache.org/">Main</a></li> |
| <li><a href="https://www.apache.org/licenses/">License</a></li> |
| <li><a href="https://apache.org/foundation/sponsorship">Sponsorship</a></li> |
| <li><a href="https://www.apache.org/foundation/sponsors">Thanks</a></li> |
| <li><a href="https://www.apache.org/foundation/policies/conduct">Conduct</a></li> |
| <li><a href="https://privacy.apache.org/policies/privacy-policy-public.html">Privacy</a></li> |
| <li><a href="https://www.apache.org/security/">Security</a></li> |
| <li class="nav-header">Project Documentation</li> |
| <li><a href="../project-info.html"><span class="icon-chevron-right"></span>Project Information</a></li> |
| <li><a href="../project-reports.html"><span class="icon-chevron-right"></span>Project Reports</a></li> |
| <li class="nav-header">Apache</li> |
| <li><a href="https://www.apache.org/">Apache Website</a></li> |
| <li><a href="https://www.apache.org/licenses/">License</a></li> |
| <li><a href="https://www.apache.org/foundation/how-it-works.html">How the ASF works</a></li> |
| <li><a href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li> |
| <li><a href="https://www.apache.org/foundation/thanks.html">Thanks</a></li> |
| <li><a href="https://www.apache.org/security/">Security</a></li> |
| </ul> |
| </nav> |
| <div class="well sidebar-nav"> |
| <form id="search-form" action="https://www.google.com/search" method="get" > |
| <input value="https://turbine.apache.org/" name="sitesearch" type="hidden" /> |
| <input class="search-query" name="q" id="query" type="text" placeholder="Search with Google..." /> |
| </form> |
| <div id="poweredBy"> |
| <div class="clear"></div> |
| <div class="clear"></div> |
| <a href="https://maven.apache.org/" class="builtBy" target="_blank"><img class="builtBy" alt="Built by Maven" src="../images/logos/maven-feather.png" /></a> |
| </div> |
| </div> |
| </header> |
| <main id="bodyColumn" class="span10"> |
| |
| |
| |
| |
| <section><a id="Pull_vs._Push"></a> |
| <h1>Pull vs. Push</h1> |
| |
| |
| <p>By: <a href="mailto:jon@latchkey.com" class="externalLink">Jon S. Stevens</a> |
| <br /> |
| $Date$ |
| </p> |
| |
| |
| <p> |
| This document is to explain a different type of philosophy for working with |
| Context based MVC tools like WebMacro (WM) and <a href="http://velocity.apache.org/engine/" class="externalLink">Velocity</a> (V) than I think that |
| the Turbine community is used to. The requirement for this philosophy has come |
| up recently during <a href="http://scarab.tigris.org/" class="externalLink">Scarab</a> |
| development and I would like to share and document it with you all. Many thanks |
| to Brian B for being patient with me and trying to explain exactly what he wants |
| to see. So, let me start off by giving a little bit of history and then moving |
| on from there... |
| </p> |
| |
| |
| <p> |
| The current encouragement that Turbine gives to developers is to do a mapping |
| between one Screen (Java) and one Template (WM or V). The way it works is that |
| you build up a Context object that is essentially a Hashtable that contains all |
| of the data that is required to render a particular template. Within the |
| template, you refer to that data in order to format it for display. I will refer |
| to this as the "Push MVC Model." This IMHO is a perfectly acceptable, easy to |
| understand and implement approach. |
| </p> |
| |
| |
| <p> |
| We have solved the problem of being able to display the data on a template |
| without requiring the engineer to make modifications to the Java code. In other |
| words, you can modify the look and feel of the overall website without the |
| requirement of having a Java engineer present to make the changes. This is |
| a very good step forward. |
| </p> |
| |
| |
| <p> |
| However, it has a shortcoming in that it makes it more difficult to allow the |
| template designer (ie: a non programmer) the ability to move information on a |
| template from one template to another template because it would require the |
| logic in the Java code to be modified as well. For example, say you have a set |
| of "wizard" type screens and you want to change the order of execution of those |
| screens or even the order of the fields on those screens. In order to do so, you |
| can't simply change the Next/Back links you need to also change the Java code. |
| </p> |
| |
| |
| <p> |
| Another example of this is if you have a form on a page and you want to be |
| able to split that form across several steps across several pages. In the |
| current model, you would have to potentially write/modify several Java classes. |
| In reality, this should be something that is easily modifiable by just a single |
| template engineer who doesn't necessarily even know Java. |
| </p> |
| |
| |
| <p> |
| There are several considerations that one must take into consideration regarding |
| the design of a system to provide this level of abstraction. For example, when |
| someone submits the form and there is an error. Proper UI would suggest that you |
| should re-display the page with the previous form data filled in as well as an |
| error message that details the problems. You also need to consider the ability |
| to display the same form that may be pre-populated with information from the |
| database instead of as an error from the user. |
| </p> |
| |
| |
| <p> |
| So, beginning with Scarab, we are going to try another model which I will |
| describe as the "Pull MVC Model". What this entails is the ability to create an |
| object that is able to "pull" the required information out at execution time |
| within the template. Thus, it becomes the job of the template designer to |
| understand the API of objects available to him/her to take advantage of. |
| </p> |
| |
| |
| <p> |
| Instead of the developer telling the designer what Context names to use for each |
| and every screen, there is instead a set of a few objects available for the |
| template designer to pick and choose from. These objects will provide methods to |
| access the underlying information either from the database or from the |
| previously submitted form information. |
| </p> |
| |
| |
| <p> |
| Gone are the days where one would have a Java class that would be responsible |
| for building the context up for the template. Instead, there would be a single |
| base class that places the few objects into the context for every request and |
| there is a documented API that the template designer can refer to in order to |
| access the information that he/she needs to get at. Of course this information |
| is only retrieved when requested and can also be managed in a cache for reuse. |
| </p> |
| |
| |
| <p> |
| By moving to a "Pull" model, it becomes possible to more easily achieve complete |
| independence from the Java engineers in order to not only change the look and |
| feel (UI) of the site but also the information architecture (IA) layout and flow |
| of the site. |
| </p> |
| |
| |
| <p> |
| While this puts more requirements on the Java engineer to make sure that the |
| template designer has a well defined API, it will save the Java engineer many |
| hours further down the road when the client requests IA changes because now the |
| responsibility is on the template designer to make the changes. Therefore the |
| increased initial developer time is justified in order to realize the long term |
| goals of the project. |
| </p> |
| |
| |
| <p> |
| I hope that this makes sense to everyone. I'm sure that some of you are probably |
| saying "well, duh!." However, this is really not the model that has been |
| encouraged so far within Turbine nor within other products such as XMLC (which |
| actually operates *only* on the Push model), so I believe that it is somewhat |
| uncharted territory for some people. The only products that I can think of right |
| now that encourage this is JSP taglibs and Tea, however, I still feel as though |
| they have missed the boat on this in one way or another. |
| </p> |
| |
| |
| <p> |
| Comments are appreciated. Please post them to the Turbine |
| <a href="/mail-lists.html">mailing list</a>. |
| </p> |
| |
| </section> |
| |
| |
| </main> |
| </div> |
| </div> |
| <hr/> |
| <footer> |
| <div class="container-fluid"> |
| <div class="row-fluid"> |
| <p>© 2000–2025 |
| <a href="https://turbine.apache.org/">Apache Software Foundation</a> |
| </p> |
| </div> |
| </div> |
| </footer> |
| </body> |
| </html> |