People place far too much importance on performance. PHP is a high level language that we use because it makes our jobs easier. Libraries are just an extension of this. You deal with performance only when performance becomes an issue by using profiling, at which point you will likely find well written libraries are not the culprit.
Performance will be an important issue until computers are completely automated...yes it's less and less so every year, but why add bloat when you don't need too???
Thats just naive and bad programming practice IMHO. Why not just have random LOOPs inside your code:
Useless, but eats processor cycles...just like adding the blat of a massive library like Smarty does to your projects...but it eats away at RAM too...
Nothing is wrong with templating, I use a PHP variation all the time and have done so for long time. Smarty doesn't offer enough features (which can't be easily emulated using straight PHP) to justify it's cost...
I would argue however that Zend Framework does offer enough benefits to justify it's cost in performance hit.
Smarty basically just assists the presentation layer in helping keep business logic out of it's scope...you can still shoot yourself in the foot however using {php} tags...so really, your just as likely to do so, then if you were going to intermingle logic using straight PHP template engine.
Also, Smarty, from what I remember...IMHO anyways, supports bad design practices...
Keeping the formatting of date/time in the presentation layer is bad...it's likely going to be hardcoded in some format which your used too. Month.day.year - year.month,day, etc...
You could possibly store that value in a smarty config file, but IMHO it's easier to let the business logic determine the formatting of such values, so changes made in the admin section will propagate througout the website immediately. This way you can store your formatting details in DB, config files, XML, etc...
If you really cared about performance you would be writing your web applications in C++. The idea is you use each language to the best of its abilities. What is clearly wrong is that people use the performance arguement as an execuse not to learn new stuff or improvement their programming style
Smarty simply doesn't offer enough advantage to justify it's use...read my previous arguments
As programmers we should take the easiest, most flexible/adapatable path in an effort to write maintainable code that has fewest bugs. If performance is important you profile and make modifications where it is necessary.
I'm like water my friend...I follow the path of least resistence all the time...I'm just lazy that way
Your arguments are valid, but out of context amigo. Yes, we should adapt to new methodologies and make better use of our time, agreed. But we also shouldn't use something based on the fact some one told us that it's the cats meow, until you fully understand what it is it's offering. Thats called naievty I think.
If someone told you to jump off a bridge, would you follow or think it through first?
Personally I'd always go with the latter
Smarty, although in theory sounds awesome, in pragmatic terms it's nothing more than a glorified version of native PHP template engine, doing nothing but eating clock cycles and chewing RAM by the mega byte.
Template lite is an optimized version of of Smarty which solves some issues of performance, but still doesn't justify using it for anything other than experimentation and research.
If they excluded the {php} at least you would have the argument that it *prevents* not just assists in helping the presetnation logic from mixing with business logic. But they can't do that because logic is occasionally required in both business/presetnation. So why learn a new syntax, which IMHO is kludgey to begin with, when I can just use what I already know, PHP???
Cheers
