vendredi 21 mars 2008

Myth buster : Smarty sucks (part 2).

One can find some interesting discussions about Smarty and template engines [here].
New myth to bust :
  • With Smarty, we create too many templates, and the site becomes impossible to maintain.
I directly refer to this article. I hope the writer had honestly managed a large project with his method. Using OOP to output html is ineffective and inefficient. The success of PHP is a good example of what I'm talking about.

I would say that the maintainability of one site 's design essentially depends of the skills of the CSS engineer/dev rather than the number of templates.

  • Smarty is slow to process
Untrue. Show me your benchmark. For oolime projects, we benchmarked every single technology we are using, and I can tell you that the overload of Smarty is not critical. Moreover, the cache mechanism helps to speed up your website. With Smarty, we can put in cache chunks of HTML and assemble them when necessary. In some words, Smarty can cache the compiled template AND the output of any template.

I saw one "ignorant guy" (sorry for the adjective, but I couldn't find better :-) telling around the place that caching mechanism were useless if a website was fast enough...

  • We can do everything in PHP, so why using Smarty ?
Smarty is written in PHP so of course you can do everything that Smarty does in PHP. That's really a non valid argument. But beware of not reinventing the wheel for nothing...

About XSL
And when someone talks with me about xsl for HTML templating, I'm crying out loud. I've been developing templates and views in XSLT for three years before discovering how stupid XSLT is for this kind of tasks.

I needed to use DOM objects instead of PHP objects (and all the troubles of memory space & exec speed that it implies) the errors in the templates syntax were not explicit (blank html page syndrom), XSLT needs a long term investment for non interesting features for HTML (need to learn xpath, xslt, advanced xml)...

XSL is good to adapt XML data in a certain format (specified by a DTD or not) into another format.

Aucun commentaire: