[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
Re: Food for thought on subject of templates
Hmm.. Well, in the case where we are talking about
app server where the only way (at least the primary) to make output
is through templates, it is true - maximum flexibility is required.
However, in case of CPPSERV primary way to output something is
through C++ API, and any template engine will be built on top of that.
Now we are talking about a framework on top of that API. This framework
will include a template engine, but it is not all that clear that engine
itself
has to provide the flexibility.
If someone feels like building complete JSP equivalent on top of CPPSERV -
no problem, it should be fairly easy. However, what I'm trying to get at, is
framework that is usefull in programs with a lot of different objects
interacting
with each other. In this case, it seems appropriate to put certain
restrictions
on the way things are organized, if we want to hide the complexity of
routing
data and requests between these objects. Thus I'm not sure allowing to take
shortcuts would be good in such a situation.
OTOH, I'll have to look at JSF, and see what ideas it has to offer.
Thanks for
the pointer :-)
Tommi Mäkitalo wrote:
>Am Freitag, 6. Januar 2006 02:48 schrieb Ilya A. Volynets-Evenbakh:
>
>
>>There are two approaches to the way templates act:
>>1. Template is main thing - it creates/retrieves objects, calls their
>>methods, etc.
>> It has access to request and responce objects, and to the resto
>>environment throught them.
>> JSP-like, from what I understand.
>>2. Alternatively template could be "secondary" - i.e. there is some sort
>>of object, that
>> performs whatever it needs to, then gets hold of template, binds
>>data to template
>> variables, and then sends results to output. This is what Velocity
>>engine does.
>>
>>I personally like second one better - it seems to force separation of
>>code and presentation
>>more. However, I'd like to hear other opinions.
>>
>>
>
>I think the best approach is not to bind users to anything. Just let the user
>decide.
>
>In JSP-like environments (as Tntnet has) you can put a object in request-scope
>and call the template, which just prints, what it finds in this object. Also
>there is at least one add-ons to JSP, which act more like your 2nd type: JSF.
>
>It would be possible to create a applicationframework on top of a
>templateengine of your first type, which acts like the 2nd.
>
>Tommi
>
>
--
Ilya A. Volynets-Evenbakh
Total Knowledge. CTO
http://www.total-knowledge.com