News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

WorkingSoftware Blog:
Your templating engine sucks & everything you've written is spaghetti code
December 14, 2011 @ 12:03:54

In a bit of a ranting post on the WorkingSoftware.com.au blog Iain Dooley shares his opinion about most of the code he's seen, specifically related to templating engines: "Your templating engine sucks and everything you have ever written is spaghetti code (yes, you)".

Templating is a real hot button in the web development community. [...] The high horses that people usually get on are that all too familiar TLA MVC (Model/View/Controller) architecture and "separation of presentation and business logic". The poor pedestrians upon which they look down are those who have written "spaghetti code" - templates where presentation logic, markup, business logic, database access configuration and whatever else you might imagine are mixed up in the same file. Well, I've got some news for you: you're all wrong.

He points out that, with most of the major templating tools out there, there's most people still put some sort of business logic in their templates. Rarely will you find a "pure" template that only echoes out the data. He gives an example of a Mustache template with "empty" logic in it. He shares a new term his coined too: "Template Animation". This is the separation of the templating process as it is usually done and splitting it so that the output is a modified DOM resource rather than a static template.

He talks about some of the advantages of this approach and an example of its use in an example of a logged in user vs not logged in user as well as a brief discussion of Markdown/HAML.

The only thing that Template Animation advocates is that the technological barrier between the frontend and the backend is never crossed - that our templates are truly logic-less.

There's lots of comments on the post already - everything from support of the idea to systems that already implement this sort of idea to disagreeing opinions.

0 comments voice your opinion now!
opinion templating engine logic separation templateanimation


blog comments powered by Disqus

Similar Posts

Nessa's Blog: PHP 5.3: Why We’re All Late to the Party

Derick Rethans: On Backwards Compatibility and not Being Evil

Reddit.com: Which MVC framework has the best documentation and user community?

Phil Sturgeon: Is PSR-0 Shortsighted, or are you?

Stefan Koopmanschap: Want to Be More Productive? Work Less!


Community Events





Don't see your event here?
Let us know!


zendserver release interview laravel introduction conference threedevsandamaybe developer code deployment api community list podcast series development tips framework language application

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework