File: pullmodel.html

package info (click to toggle)
turbine 20010419-1
  • links: PTS
  • area: contrib
  • in suites: woody
  • size: 17,460 kB
  • ctags: 7,501
  • sloc: java: 41,929; xml: 12,430; sql: 637; sh: 90; makefile: 50
file content (281 lines) | stat: -rw-r--r-- 12,572 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<!-- Content Stylesheet for Site -->

        
<!-- start the processing -->
    <!-- ====================================================================== -->
    <!-- Main Page Section -->
    <!-- ====================================================================== -->
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>

                                                    <meta name="author" value="Jon S. Stevens">
            <meta name="email" value="jon@latchkey.com">
            
            <title>Turbine - Pull vs. Push</title>
        </head>

        <body bgcolor="#ffffff" text="#000000" link="#525D76">        
            <table border="0" width="100%" cellspacing="0">
                <!-- TOP IMAGE -->
                <tr>
                    <td align="left">
<a href="http://jakarta.apache.org"><img src="http://jakarta.apache.org/images/jakarta-logo.gif" border="0"/></a>
</td>
<td align="right">
<a href="http://jakarta.apache.org/turbine/"><img src="./images/logo.gif" alt="Turbine" border="0"/></a>
</td>
                </tr>
            </table>
            <table border="0" width="100%" cellspacing="4">
                <tr><td colspan="2">
                    <hr noshade="" size="1"/>
                </td></tr>
                
                <tr>
                    <!-- LEFT SIDE NAVIGATION -->
                    <td valign="top" nowrap="true">
                                <p><strong>Essentials</strong></p>
        <ul>
                    <li>    <a href="./index.html">Overview</a>
</li>
                    <li>    <a href="./features.html">Features</a>
</li>
                    <li>    <a href="./fsd.html">Specification</a>
</li>
                    <li>    <a href="./project-map.html">Project map</a>
</li>
                    <li>    <a href="./install.html">Installation</a>
</li>
                    <li>    <a href="./getting-started.html">Getting Started</a>
</li>
                    <li>    <a href="./changes.html">Changes</a>
</li>
                    <li>    <a href="./other-docs.html">Other Documentation</a>
</li>
                </ul>
            <p><strong>Models</strong></p>
        <ul>
                    <li>    <a href="./pullmodel.html">Pull MVC Model</a>
</li>
                    <li>    <a href="./model2+1.html">Model 2+1</a>
</li>
                    <li>    <a href="./j2ee-integration.html">J2EE Integration</a>
</li>
                </ul>
            <p><strong>Get Involved</strong></p>
        <ul>
                    <li>    <a href="./turbine-documentation-project.html">Turbine Documentation</a>
</li>
                    <li>    <a href="./code-standards.html">Coding Spec</a>
</li>
                    <li>    <a href="./contributors.html">Contributors</a>
</li>
                    <li>    <a href="./branches.html">CVS Branches</a>
</li>
                    <li>    <a href="http://jakarta.apache.org/site/cvsindex.html">CVS Repos</a>
</li>
                    <li>    <a href="./faq.html">FAQ</a>
</li>
                    <li>    <a href="./license.html">License</a>
</li>
                    <li>    <a href="http://jakarta.apache.org/site/mail.html">Mailing Lists</a>
</li>
                    <li>    <a href="./powered.html">Powered by Turbine</a>
</li>
                    <li>    <a href="./todo.html">Todo</a>
</li>
                    <li>    <a href="./active-developers.html">Active Developers</a>
</li>
                    <li>    <a href="./proposals.html">Proposals</a>
</li>
                </ul>
            <p><strong>Documentation</strong></p>
        <ul>
                    <li>    <a href="./action-event.html">Action Events</a>
</li>
                    <li>    <a href="./services.html">Services</a>
</li>
                    <li>    <a href="./security.html">Turbine and Security</a>
</li>
                    <li>    <a href="./python.html">Turbine and Python</a>
</li>
                    <li>    <a href="./jsp-configuration.html">Turbine and JSP</a>
</li>
                    <li>    <a href="./velocity-site.html">Velocity Site</a>
</li>
                    <li>    <a href="./context-howto.html">Velocity Context</a>
</li>
                    <li>    <a href="./webmacro-site.html">Webmacro Site</a>
</li>
                </ul>
            <p><strong>Database</strong></p>
        <ul>
                    <li>    <a href="./peers.html">Peers</a>
</li>
                    <li>    <a href="./advpeers.html">Advanced Peers</a>
</li>
                    <li>    <a href="./advcriteria.html">Advanced Criteria</a>
</li>
                    <li>    <a href="./torque.html">Torque</a>
</li>
                    <li>    <a href="./turbine-schema.html">Core Schema</a>
</li>
                    <li>    <a href="./db-adapters.html">DB Adapters</a>
</li>
                    <li>    <a href="./postgres-howto.html">Postgres Howto</a>
</li>
                    <li>    <a href="./oracle-howto.html">Oracle 8i Howto</a>
</li>
                    <li>    <a href="./sybase-howto.html">Sybase Howto</a>
</li>
                </ul>
                        </td>
                    <td align="left" valign="top">
                                                                    <table border="0" cellspacing="0" cellpadding="2" width="100%">
      <tr><td bgcolor="#525D76">
        <font color="#ffffff" face="arial,helvetica,sanserif">
          <a name="Pull vs. Push"><strong>Pull vs. Push</strong></a>
        </font>
      </td></tr>
      <tr><td>
        <blockquote>
                                    <p>By: <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
<br />
$Date: 2001/04/18 13:57:30 $
</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://jakarta.apache.org/velocity/">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/">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="http://jakarta.apache.org/site/mail.html">mailing list</a>.
</p>
                            </blockquote>
      </td></tr>
    </table>
                                        </td>
                </tr>

                <!-- FOOTER -->
                <tr><td colspan="2">
                    <hr noshade="" size="1"/>
                </td></tr>
                <tr><td colspan="2">
                    <div align="center"><font color="#525D76" size="-1"><em>
                    Copyright &#169; 1999-2001, Apache Software Foundation
                    </em></font></div>
                </td></tr>
            </table>
        </body>
    </html>
<!-- end the processing -->