<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Wed, 19 Jun 2013 15:26:31 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[WorkingSoftware Blog: Your templating engine sucks & everything you've written is spaghetti code]]></title>
      <guid>http://www.phpdeveloper.org/news/17259</guid>
      <link>http://www.phpdeveloper.org/news/17259</link>
      <description><![CDATA[<p>
In a bit of a ranting post on the WorkingSoftware.com.au blog <i>Iain Dooley</i> 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)".
</p>
<blockquote>
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.
</blockquote>
<p>
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 <a href="http://mustache.github.com">Mustache</a> 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. 
</p>
<p>
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.
</p>
<blockquote>
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.
</blockquote>
<p>
There's <a href="http://www.workingsoftware.com.au/page/Your_templating_engine_sucks_and_everything_you_have_ever_written_is_spaghetti_code_yes_you">lots of comments on the post</a> already - everything from support of the idea to systems that already implement this sort of idea to disagreeing opinions.
</p>]]></description>
      <pubDate>Wed, 14 Dec 2011 12:03:54 -0600</pubDate>
    </item>
  </channel>
</rss>
