[stringtemplate-interest] StringTemplate and ability to compose a view

Terence Parr parrt at cs.usfca.edu
Sat Jan 22 11:23:52 PST 2011


On Jan 14, 2011, at 6:22 AM, Jevgenij [GMail] wrote:
> What I like about ST is that is provides both inheritance and
> composition for producing views. But it seems, for composition we need
> to duplicate the composition logic. (In model and view, or controller)
> 
> Am I getting this backwards? I think I am looking for a good system to
> achieve composition of websites of smaller reusable units, without
> duplication of composition logic.

I think I keep as much logic as possible in the model and then simply ask for templates, building up a tree of templates. jguru supported multiple site "skins" no problem from one "code generator".

> Maybe we can discuss an example: A site that supports 2 different
> target platforms: mobile and desktop.

Yep, jGuru had multiple branded sites that looks totally different, but there was exactly one engine underneath. It also had a big difference between public and logged in users' views. no problem.

> The Controller identifies the target platform, executes the model
> logic, and delegates data to the platform specific view.
> For the desktop version we want a rich header, but no header for the
> mobile version. (Or other elements)
> What would you suggest for this use case? (Maybe a tutorial I might
> have overlooked.)

Yep, for me, it was simply a different group of templates. one pointer change, and the output looks totally different. :)

Ter
>> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20110122/947cbd59/attachment.html 


More information about the stringtemplate-interest mailing list