<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for totes profesh</title>
	<atom:link href="http://www.garann.com/dev/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.garann.com/dev</link>
	<description>web development, UI issues, HTML, CSS, Javascript, and shit talking</description>
	<lastBuildDate>Fri, 28 Dec 2012 13:30:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>Comment on using javascript templates by Enrique Amodeo</title>
		<link>http://www.garann.com/dev/2012/using-javascript-templates/#comment-7485</link>
		<dc:creator>Enrique Amodeo</dc:creator>
		<pubDate>Fri, 28 Dec 2012 13:30:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.garann.com/dev/?p=326#comment-7485</guid>
		<description><![CDATA[Good post, specially the part about self contained widgets.

I&#039;ve been reading the comments and I think the topic about transforming your data so that it can be used to hydrate a logic less template is very important.

Some people want logic full template because they want to embed that kind of transformation logic into the template, but that violates the SoC. Templates should be used to render HTML (or CSS...) but not to transform data too, they are completely unrelated concerns. That&#039;s why I prefer logic less templates.

It is usually the case you need two different models. A model to use for business logic and another one for template rendering. The transformation between both can be done either in a method of the former, or in an adapter/wrapper for the template. This transformation can take care of formatting issues (currency, dates) and even structural changes. The formatting logic usually have internationalization issues, so it&#039;s not so simple as may appear at first look. Of course if both data structures are exactly the same, and no special formatting is needed, this intermediate transformation layer is not needed. This way we avoid violating SoC and have a more testable system.]]></description>
		<content:encoded><![CDATA[<p>Good post, specially the part about self contained widgets.</p>
<p>I&#8217;ve been reading the comments and I think the topic about transforming your data so that it can be used to hydrate a logic less template is very important.</p>
<p>Some people want logic full template because they want to embed that kind of transformation logic into the template, but that violates the SoC. Templates should be used to render HTML (or CSS&#8230;) but not to transform data too, they are completely unrelated concerns. That&#8217;s why I prefer logic less templates.</p>
<p>It is usually the case you need two different models. A model to use for business logic and another one for template rendering. The transformation between both can be done either in a method of the former, or in an adapter/wrapper for the template. This transformation can take care of formatting issues (currency, dates) and even structural changes. The formatting logic usually have internationalization issues, so it&#8217;s not so simple as may appear at first look. Of course if both data structures are exactly the same, and no special formatting is needed, this intermediate transformation layer is not needed. This way we avoid violating SoC and have a more testable system.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on using javascript templates by Pete Peterson</title>
		<link>http://www.garann.com/dev/2012/using-javascript-templates/#comment-7475</link>
		<dc:creator>Pete Peterson</dc:creator>
		<pubDate>Thu, 27 Dec 2012 16:59:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.garann.com/dev/?p=326#comment-7475</guid>
		<description><![CDATA[I would like to add a point of frustration with JS templating and the whole front-end framework movement in general.

Firstly, mostly the frameworks are built, or intended for single page apps as you pointed out. The problems in having maintainable code, templates and resources across a larger site comes down to having strict design guidelines, so the bulk of the JS logic and the templates can be reused. This is minor for a new build, horrible for retrofitting an older larger system that has very little reusable &quot;modules&quot;.

Secondly, as @Kyle pointed out, and in your response to him. There is some inherent logic that needs to be handled in displaying some information. That logic, at least I&#039;ve found, has to be replicated on both the back end and the front end in some cases. This drives me crazy, but I don&#039;t know of way around the issue unless all the rendering gets done either on the front end or the back end.  There are pros and cons to either so....whats a guy to do other than cringe and replicate logic? I find that there are more cases where violating SoC, DRY than I feel comfortable with.  

I&#039;ve found the roadblocks and issues with client-side rendering to be a huge PITA. I would love a much simpler solution, but have yet to find one that works. Perhaps this approach is truly best suited for a strict design pattern on new sites. IDK.

I am glad to know that what I have done is generally matching your approach.  I&#039;m interested to see how this space develops. I would love to see more REAL world examples how others are solving some of these issues. The de facto TODO app examples are worthless in this regard.]]></description>
		<content:encoded><![CDATA[<p>I would like to add a point of frustration with JS templating and the whole front-end framework movement in general.</p>
<p>Firstly, mostly the frameworks are built, or intended for single page apps as you pointed out. The problems in having maintainable code, templates and resources across a larger site comes down to having strict design guidelines, so the bulk of the JS logic and the templates can be reused. This is minor for a new build, horrible for retrofitting an older larger system that has very little reusable &#8220;modules&#8221;.</p>
<p>Secondly, as @Kyle pointed out, and in your response to him. There is some inherent logic that needs to be handled in displaying some information. That logic, at least I&#8217;ve found, has to be replicated on both the back end and the front end in some cases. This drives me crazy, but I don&#8217;t know of way around the issue unless all the rendering gets done either on the front end or the back end.  There are pros and cons to either so&#8230;.whats a guy to do other than cringe and replicate logic? I find that there are more cases where violating SoC, DRY than I feel comfortable with.  </p>
<p>I&#8217;ve found the roadblocks and issues with client-side rendering to be a huge PITA. I would love a much simpler solution, but have yet to find one that works. Perhaps this approach is truly best suited for a strict design pattern on new sites. IDK.</p>
<p>I am glad to know that what I have done is generally matching your approach.  I&#8217;m interested to see how this space develops. I would love to see more REAL world examples how others are solving some of these issues. The de facto TODO app examples are worthless in this regard.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on using javascript templates by Andreas Müller</title>
		<link>http://www.garann.com/dev/2012/using-javascript-templates/#comment-7413</link>
		<dc:creator>Andreas Müller</dc:creator>
		<pubDate>Mon, 24 Dec 2012 09:52:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.garann.com/dev/?p=326#comment-7413</guid>
		<description><![CDATA[Nice Article! Have you tried client side templating tools, e.g. google closure templates, mustache, jquery-templates?]]></description>
		<content:encoded><![CDATA[<p>Nice Article! Have you tried client side templating tools, e.g. google closure templates, mustache, jquery-templates?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on using javascript templates by garann</title>
		<link>http://www.garann.com/dev/2012/using-javascript-templates/#comment-7377</link>
		<dc:creator>garann</dc:creator>
		<pubDate>Fri, 21 Dec 2012 19:17:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.garann.com/dev/?p=326#comment-7377</guid>
		<description><![CDATA[@Luis - Yeah, that sounds like a sane way of organizing it to me. Would your template and CSS also contain the various states the View could be in? I think this ties into what @Mike is saying about widgets, so I&#039;ll take it into account when I add a bit about those. Thanks!]]></description>
		<content:encoded><![CDATA[<p>@Luis &#8211; Yeah, that sounds like a sane way of organizing it to me. Would your template and CSS also contain the various states the View could be in? I think this ties into what @Mike is saying about widgets, so I&#8217;ll take it into account when I add a bit about those. Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on using javascript templates by garann</title>
		<link>http://www.garann.com/dev/2012/using-javascript-templates/#comment-7376</link>
		<dc:creator>garann</dc:creator>
		<pubDate>Fri, 21 Dec 2012 19:14:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.garann.com/dev/?p=326#comment-7376</guid>
		<description><![CDATA[@Mike - Thanks! Self-contained widgets are one of my favorite use cases for templates, actually, and that&#039;s totally an oversight on my part. I&#039;m going to add something. Also, I agree that doT is awesome. :D]]></description>
		<content:encoded><![CDATA[<p>@Mike &#8211; Thanks! Self-contained widgets are one of my favorite use cases for templates, actually, and that&#8217;s totally an oversight on my part. I&#8217;m going to add something. Also, I agree that doT is awesome. <img src='http://www.garann.com/dev/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on using javascript templates by garann</title>
		<link>http://www.garann.com/dev/2012/using-javascript-templates/#comment-7375</link>
		<dc:creator>garann</dc:creator>
		<pubDate>Fri, 21 Dec 2012 19:12:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.garann.com/dev/?p=326#comment-7375</guid>
		<description><![CDATA[@Kyle - I kind of stayed away from that topic, because I didn&#039;t want to get to specific to any one approach. I&#039;m in favor of violating SoC up to a point, but I&#039;m also very aware that then you have to be able to parse your template as JS on the backend, if you&#039;re sharing templates, and that can be a big problem. But the alternative is having duplicate presentation logic libraries for the client and the server, and I&#039;m not sure if that&#039;s objectively better. Well, I guess there&#039;s also the third path, transforming the data when it&#039;s requested, which is what I think you mean by &quot;code-behind&quot;? (My .NET experience might be confusing my interpretation here.) I see that as hurting the flexibility of the data returned, though, because you might have to parse a string to get the data you actually want. 

I don&#039;t think there&#039;s a single ideal approach. One of my favorite things about using JS on both the front- and back-end is that you can then use the same data transformation layer, in the same file, for each case. If you don&#039;t have that luxury, I think you have to accept that you&#039;re going to violate SoC, DRY, or both. That might be a reason to question whether you need to do rendering on both sides after all.]]></description>
		<content:encoded><![CDATA[<p>@Kyle &#8211; I kind of stayed away from that topic, because I didn&#8217;t want to get to specific to any one approach. I&#8217;m in favor of violating SoC up to a point, but I&#8217;m also very aware that then you have to be able to parse your template as JS on the backend, if you&#8217;re sharing templates, and that can be a big problem. But the alternative is having duplicate presentation logic libraries for the client and the server, and I&#8217;m not sure if that&#8217;s objectively better. Well, I guess there&#8217;s also the third path, transforming the data when it&#8217;s requested, which is what I think you mean by &#8220;code-behind&#8221;? (My .NET experience might be confusing my interpretation here.) I see that as hurting the flexibility of the data returned, though, because you might have to parse a string to get the data you actually want. </p>
<p>I don&#8217;t think there&#8217;s a single ideal approach. One of my favorite things about using JS on both the front- and back-end is that you can then use the same data transformation layer, in the same file, for each case. If you don&#8217;t have that luxury, I think you have to accept that you&#8217;re going to violate SoC, DRY, or both. That might be a reason to question whether you need to do rendering on both sides after all.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on using javascript templates by garann</title>
		<link>http://www.garann.com/dev/2012/using-javascript-templates/#comment-7374</link>
		<dc:creator>garann</dc:creator>
		<pubDate>Fri, 21 Dec 2012 19:01:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.garann.com/dev/?p=326#comment-7374</guid>
		<description><![CDATA[@Angus - Ah, but I didn&#039;t exactly say that. ;) I said &quot;... instead of JSON&quot;. As part of some JSON is a different story, cause you still have access to the data without having to scrape it out of some markup. I do see your point, though. And I agree that client-side rendering is not the right choice for every application. I think there&#039;s a stronger argument for it in very application-y applications, where there&#039;s a high level and probability of interactivity for everything on the page, and referring back to the server for the application&#039;s state might become onerous. Even there, though, optimizing is something that can only be done on a case-by-case basis. I guess my stance is that if you&#039;re sending data to the client, you should expect as a default to use it as data, and thus you should expect as a default to do client-side rendering. If you ultimately find that it makes more sense to do it server-side, of course that&#039;s the right answer.]]></description>
		<content:encoded><![CDATA[<p>@Angus &#8211; Ah, but I didn&#8217;t exactly say that. <img src='http://www.garann.com/dev/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  I said &#8220;&#8230; instead of JSON&#8221;. As part of some JSON is a different story, cause you still have access to the data without having to scrape it out of some markup. I do see your point, though. And I agree that client-side rendering is not the right choice for every application. I think there&#8217;s a stronger argument for it in very application-y applications, where there&#8217;s a high level and probability of interactivity for everything on the page, and referring back to the server for the application&#8217;s state might become onerous. Even there, though, optimizing is something that can only be done on a case-by-case basis. I guess my stance is that if you&#8217;re sending data to the client, you should expect as a default to use it as data, and thus you should expect as a default to do client-side rendering. If you ultimately find that it makes more sense to do it server-side, of course that&#8217;s the right answer.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on using javascript templates by Mike McNally</title>
		<link>http://www.garann.com/dev/2012/using-javascript-templates/#comment-7373</link>
		<dc:creator>Mike McNally</dc:creator>
		<pubDate>Fri, 21 Dec 2012 15:16:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.garann.com/dev/?p=326#comment-7373</guid>
		<description><![CDATA[@Kyle - because I was converting a JSP (server-side template) application to client-side, I decided to ease my pain by concocting some build-time tools to allow me to keep my client-side template code in the same files with the server-side JSP that builds JSON responses. That way, as I realize needs for things like boolean flags that require server-side data/logic, I can update the JSON-builder code in the same file as the template that consumes it.  It&#039;s turned out to be really handy, if a little weird.

All the tools do is split up the JSP source into the pure JSP part (which is handled pretty ordinarily by the rest of the server-side code), and then one or more template files. Those are then translated by doT and collected into a single blob for the client. (My app isn&#039;t big enough for me to worry about separate template bundles and require.js or anything like that.)]]></description>
		<content:encoded><![CDATA[<p>@Kyle &#8211; because I was converting a JSP (server-side template) application to client-side, I decided to ease my pain by concocting some build-time tools to allow me to keep my client-side template code in the same files with the server-side JSP that builds JSON responses. That way, as I realize needs for things like boolean flags that require server-side data/logic, I can update the JSON-builder code in the same file as the template that consumes it.  It&#8217;s turned out to be really handy, if a little weird.</p>
<p>All the tools do is split up the JSP source into the pure JSP part (which is handled pretty ordinarily by the rest of the server-side code), and then one or more template files. Those are then translated by doT and collected into a single blob for the client. (My app isn&#8217;t big enough for me to worry about separate template bundles and require.js or anything like that.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on using javascript templates by Luís Cardoso</title>
		<link>http://www.garann.com/dev/2012/using-javascript-templates/#comment-7371</link>
		<dc:creator>Luís Cardoso</dc:creator>
		<pubDate>Fri, 21 Dec 2012 14:32:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.garann.com/dev/?p=326#comment-7371</guid>
		<description><![CDATA[First, nice article. It speaks to some of the issues that I have been encountering regarding client side templates. 

In the end of the article you talk about having a nice abstraction that accepts the name of the template. Currently I am thinking about taking that a bit further by organizing my client side code in a way that for every view (as in MV* views) there is a folder which contains the view itself, corresponding template and  CSS/LESS/whatever. In this approach the template and CSS would be automatically associated with the view. Do you think this is a good approach? I think it will help a lot with maintainability and reduce the time that I spend making boilerplate code but I am a bit afraid that I will run into limitation as my views become more complex.

Thanks!]]></description>
		<content:encoded><![CDATA[<p>First, nice article. It speaks to some of the issues that I have been encountering regarding client side templates. </p>
<p>In the end of the article you talk about having a nice abstraction that accepts the name of the template. Currently I am thinking about taking that a bit further by organizing my client side code in a way that for every view (as in MV* views) there is a folder which contains the view itself, corresponding template and  CSS/LESS/whatever. In this approach the template and CSS would be automatically associated with the view. Do you think this is a good approach? I think it will help a lot with maintainability and reduce the time that I spend making boilerplate code but I am a bit afraid that I will run into limitation as my views become more complex.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on using javascript templates by Mike McNally</title>
		<link>http://www.garann.com/dev/2012/using-javascript-templates/#comment-7370</link>
		<dc:creator>Mike McNally</dc:creator>
		<pubDate>Fri, 21 Dec 2012 14:31:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.garann.com/dev/?p=326#comment-7370</guid>
		<description><![CDATA[Hi Garann.  I&#039;ve been using doT.js on an overhaul of our web application. This post has given me significant relief in that it suggests I haven&#039;t been doing horribly sinful things.  I&#039;ve really enjoyed the flexibility of moving from JSP (ugh) to doT (actually I still use JSP to build JSON responses, a purpose for which it works OK).

One thing that I do that&#039;s not really emphasized in your post is to exploit the template system for common application widgets. For example, my site has a convention of marking forms etc. with little [?] buttons (we call them, &quot;what&#039;s this? bubbles&quot;).  You click/tap on a question mark button and up pops some explanatory text, often with live data mixed in (&quot;Here&#039;s why your account balance is $123&quot; etc). Well to do that there&#039;s some boilerplate HTML that&#039;s repeated to set things up for the JavaScript that responds to the clicks - class names, positioning elements, etc.  In the JSP world, I used a custom tag, but in doT I just have a template that does the opening and closing markup.  That&#039;s good for several reasons: it avoids repeating that markup in template after template, saving some space. It also means that if I need to update the &quot;What&#039;s this?&quot; mechanism, I can do it in just one place.

I realize that &quot;calling a template from inside a template&quot; is heretical to some people, as one could think of it as &quot;logic&quot;.  Personally, I don&#039;t think of it like that at all, and even if I did I think that sticking to DRY principles is far more important. (I also realize that not all template systems allow this; in my case it&#039;s one of the main reasons I love doT so much.)

Thanks for the awesome post!]]></description>
		<content:encoded><![CDATA[<p>Hi Garann.  I&#8217;ve been using doT.js on an overhaul of our web application. This post has given me significant relief in that it suggests I haven&#8217;t been doing horribly sinful things.  I&#8217;ve really enjoyed the flexibility of moving from JSP (ugh) to doT (actually I still use JSP to build JSON responses, a purpose for which it works OK).</p>
<p>One thing that I do that&#8217;s not really emphasized in your post is to exploit the template system for common application widgets. For example, my site has a convention of marking forms etc. with little [?] buttons (we call them, &#8220;what&#8217;s this? bubbles&#8221;).  You click/tap on a question mark button and up pops some explanatory text, often with live data mixed in (&#8220;Here&#8217;s why your account balance is $123&#8243; etc). Well to do that there&#8217;s some boilerplate HTML that&#8217;s repeated to set things up for the JavaScript that responds to the clicks &#8211; class names, positioning elements, etc.  In the JSP world, I used a custom tag, but in doT I just have a template that does the opening and closing markup.  That&#8217;s good for several reasons: it avoids repeating that markup in template after template, saving some space. It also means that if I need to update the &#8220;What&#8217;s this?&#8221; mechanism, I can do it in just one place.</p>
<p>I realize that &#8220;calling a template from inside a template&#8221; is heretical to some people, as one could think of it as &#8220;logic&#8221;.  Personally, I don&#8217;t think of it like that at all, and even if I did I think that sticking to DRY principles is far more important. (I also realize that not all template systems allow this; in my case it&#8217;s one of the main reasons I love doT so much.)</p>
<p>Thanks for the awesome post!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
