in reply to Re: RFC - Template::Empty
in thread RFC - Template::Empty
I covered a few people's attempts at this in my Choosing a Template System essay.Well..... every system you cover falls into the models you describe in your overview - pipeline or callback. Seamstress and XMLC do not fit into either of those categories. Both pipeline and callback are pull-style. XMLC and Seamstress are push-style.
My favorite example of this type is the now defunct HTML_Tree. It never really caught on.There is a book called "The Outsider" by Colin Wilson which explains things like this. Some things are not supposed to catch on... take a look at the bell curve and it would be clear why... Einstein did not catch on.. Dvorak did not catch on...
There have been other tries in Java, like XMLC. They also failed to gather a large following.XMLC is a pretty solid project. Sure, it's a minority product, but it is the presentation layer of the Enhydra Application Server. . It is also used in the Barracuda MVC framework. And finally Sams published a book on it.
I would agree that it does not have a _large_ following. But it definitely is a proven industrial strength technology, with active development and user base over 6 years. Not only that, but they use DOM to do it... Java people seem to handle verbosity much better than us Perlers.
Most people stayed with things like JSP and Velocity.I would agree with you. But staying with something doesnt mean it's better. It could be for legacy reasons, familiarity reasons, etc.
I think the reality is that DOM-based HTML manipulation gets cumbersome for complex templates.well DOM _is_ cumbersome.. HTML::Tree is a very Perlish DOM. a very slick product indeed. All hail Sean Burke for a job more than well-done. And Python has some very slick XML mungers, 4suite for instance is incredibly elegant for munging XML.
It also ties your code very tightly to the presentation.Now perrin what do you mean by that? If the code is supposed to present something, then of course it is tied to it. :) But again, you are using "your code" in the same vague sense that Rhandom used "code layer" -- both of you speak about it, but provide no examples, either in your replies or link to any document on the web, peer-reviewed or not.
Do me a favor and demonstrate the flaws. All through this thread, I am providing CODE to back up the seamstress approach. I need you two to meet me on that practical level, not verbal theoretical level.
So, if you want to pursue this, I'd suggest moving away from the DOM-like approach in your example and going to something more like HTML_Tree, HTML::Seamstress, and XMLC.HTML_Tree is not like Seamstress or XMLC. HTML_Tree is like Petal.
Petal and Seamstress share one benefit - you are 100% guaranteed HTML which can be viewed with HTML tools with no choking on mini-language constructs. But the approach to use Petal and HTML_Tree (and Data::DRef from back in the day:) is vastly different from XMLC and Seamstress.
HTML_Tree is pull-style. The other notable push-style thing I've run across besides stringtemplate is meld3 by Chris mcDonough in Python. It is a very nice tool to work with. Too bad it is based on elementtree which is one of the weaker HTML/XML engines for Python.
| I have beheld the tarball of 22.1 on ftp.gnu.org with my own eyes. How can you say that there is no God in the Church of Emacs? -- David Kastrup |
|
| Enforce strict model-view separation in template engines via HTML::Seamstress | The car is in the cdr, not the cdr in the car |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTML::Seamstress - the Outsider
by perrin (Chancellor) on Feb 25, 2008 at 20:14 UTC | |
by metaperl (Curate) on Feb 26, 2008 at 17:17 UTC | |
|
Re: HTML::Seamstress - the Outsider
by Rhandom (Curate) on Feb 25, 2008 at 19:38 UTC | |
by metaperl (Curate) on Feb 25, 2008 at 20:48 UTC | |
by Rhandom (Curate) on Feb 25, 2008 at 22:13 UTC | |
by metaperl (Curate) on Feb 26, 2008 at 18:12 UTC |