This post by Mike Morgan “Scalable PHP with APC, memcached and LVS (Part 2)” includes the increasingly popular opinion that Smarty is a waste of time.
I’ve used Smarty successfully in the past and been pleased with the result, particularly on Geograph where we need to maintain reasonable code quality with potentially many developers of varying levels. You’re forced to handle the presentation logic separately – a “good thing”.
I believe the primary purpose of any programming language is to communicate ideas and algorithms to other programmers – not computers. In this respect, PHP+Smarty does a good job.
However, while I like it and use it, I recognise one of the main failings of Smarty is debugging – the template is turned into PHP code which really wasn’t meant for human eyes. Single-step through it at your peril.
Pastebin doesn’t use Smarty, but then it only really has one page to display. However, to make it easy to integrate into other sites, it is templatable. It gathers all the data required on a page and then includes a separate php file to format it for display. Simple, yes, but has all the benefits of Smarty with the ability to debug it too.
In a wider sense, what’s really needed are more common patterns of PHP code structure to help push better practices out there. Getting smart without Smarty. The Zend Framework includes a Zend_Controller set of classes, which aid in adopting an MVC pattern. Too early to say whether it will take off, but it’s a good effort.
Maybe I should just switch to Ruby on Rails. It’s got everything I want, I’m just waiting for the right project to give it a decent crack of the whip…
you probably also want to have a look into myghty (http://www.myghty.org/) and Nevow (http://divmod.org/projects/nevow). I neither like ruby nor php – py is still my favourite language, although I’ll have a look into erlang now – just for fun and because it has a ton of pretty nice features.
Getting to grips with Python is on my big list of things to do in April, though I am more looking at Python as something I might use as a replacement for the unmaintainable style of Perl I churn out!
Do something in Ruby on Rails, and you’ll never want to touch php again. 😉