<?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 on: Don&#8217;t Execute A Backbone.js Route Handler From Your Code</title>
	<atom:link href="http://lostechies.com/derickbailey/2011/08/28/dont-execute-a-backbone-js-route-handler-from-your-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/derickbailey/2011/08/28/dont-execute-a-backbone-js-route-handler-from-your-code/</link>
	<description>Better Than Yesterday</description>
	<lastBuildDate>Fri, 24 May 2013 06:39:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: simplynutty</title>
		<link>http://lostechies.com/derickbailey/2011/08/28/dont-execute-a-backbone-js-route-handler-from-your-code/#comment-3174</link>
		<dc:creator>simplynutty</dc:creator>
		<pubDate>Thu, 04 Apr 2013 04:09:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=525#comment-3174</guid>
		<description>Thanks!  The lack of &quot;you have to code this way&quot; is what I love about backbone but it&#039;s also frustrating.  I came up with at least 3 or 4 different ways to solve a problem I&#039;ve been working on and could talk myself in or out of all of them. :/</description>
		<content:encoded><![CDATA[<p>Thanks!  The lack of &#8220;you have to code this way&#8221; is what I love about backbone but it&#8217;s also frustrating.  I came up with at least 3 or 4 different ways to solve a problem I&#8217;ve been working on and could talk myself in or out of all of them. :/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derick Bailey</title>
		<link>http://lostechies.com/derickbailey/2011/08/28/dont-execute-a-backbone-js-route-handler-from-your-code/#comment-3173</link>
		<dc:creator>Derick Bailey</dc:creator>
		<pubDate>Wed, 03 Apr 2013 12:22:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=525#comment-3173</guid>
		<description>if you&#039;re just grabbing the hash fragment and passing that to the router, don&#039;t bother. just let the browser fire the navigation event when the link is clicked. 


this article is rather convoluted, and difficult to follow, honestly. i didn&#039;t do a good of explaining the nuances and situations. i should re-write this at some point.</description>
		<content:encoded><![CDATA[<p>if you&#8217;re just grabbing the hash fragment and passing that to the router, don&#8217;t bother. just let the browser fire the navigation event when the link is clicked. </p>
<p>this article is rather convoluted, and difficult to follow, honestly. i didn&#8217;t do a good of explaining the nuances and situations. i should re-write this at some point.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: simplynutty</title>
		<link>http://lostechies.com/derickbailey/2011/08/28/dont-execute-a-backbone-js-route-handler-from-your-code/#comment-3172</link>
		<dc:creator>simplynutty</dc:creator>
		<pubDate>Wed, 03 Apr 2013 03:49:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=525#comment-3172</guid>
		<description>@derickbailey:disqus What&#039;s your take on this? I think I understand the example you used which is model-based but what about navigation links which aren&#039;t really tired to a model?  I have a few links in the header: #projects, #admin, #reports and I have a method which grabs the data-fragment value and passes it to router.navigate.  I&#039;d rather just use plain hrefs.  Thoughts?</description>
		<content:encoded><![CDATA[<p>@derickbailey:disqus What&#8217;s your take on this? I think I understand the example you used which is model-based but what about navigation links which aren&#8217;t really tired to a model?  I have a few links in the header: #projects, #admin, #reports and I have a method which grabs the data-fragment value and passes it to router.navigate.  I&#8217;d rather just use plain hrefs.  Thoughts?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derick Bailey</title>
		<link>http://lostechies.com/derickbailey/2011/08/28/dont-execute-a-backbone-js-route-handler-from-your-code/#comment-3168</link>
		<dc:creator>Derick Bailey</dc:creator>
		<pubDate>Fri, 29 Mar 2013 17:31:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=525#comment-3168</guid>
		<description>i usually do that in my &quot;mediator&quot; objects (aka &quot;workflow&quot; objects): http://lostechies.com/derickbailey/2012/05/10/modeling-explicit-workflow-with-code-in-javascript-and-backbone-apps/

that example shows view events being bound, but the same idea applies - just binding to the event from a different object.</description>
		<content:encoded><![CDATA[<p>i usually do that in my &#8220;mediator&#8221; objects (aka &#8220;workflow&#8221; objects): <a href="http://lostechies.com/derickbailey/2012/05/10/modeling-explicit-workflow-with-code-in-javascript-and-backbone-apps/" rel="nofollow">http://lostechies.com/derickbailey/2012/05/10/modeling-explicit-workflow-with-code-in-javascript-and-backbone-apps/</a></p>
<p>that example shows view events being bound, but the same idea applies &#8211; just binding to the event from a different object.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jake Smith</title>
		<link>http://lostechies.com/derickbailey/2011/08/28/dont-execute-a-backbone-js-route-handler-from-your-code/#comment-3167</link>
		<dc:creator>Jake Smith</dc:creator>
		<pubDate>Fri, 29 Mar 2013 17:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=525#comment-3167</guid>
		<description>Where would be a good place in the application to bind the &quot;post:selected&quot; event? Does it make the most sense to bind the event in the view that&#039;s being loaded? That doesn&#039;t seem right to me though.</description>
		<content:encoded><![CDATA[<p>Where would be a good place in the application to bind the &#8220;post:selected&#8221; event? Does it make the most sense to bind the event in the view that&#8217;s being loaded? That doesn&#8217;t seem right to me though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: maoshuyu</title>
		<link>http://lostechies.com/derickbailey/2011/08/28/dont-execute-a-backbone-js-route-handler-from-your-code/#comment-2980</link>
		<dc:creator>maoshuyu</dc:creator>
		<pubDate>Thu, 17 Jan 2013 15:50:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=525#comment-2980</guid>
		<description>test</description>
		<content:encoded><![CDATA[<p>test</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Edan</title>
		<link>http://lostechies.com/derickbailey/2011/08/28/dont-execute-a-backbone-js-route-handler-from-your-code/#comment-2813</link>
		<dc:creator>Edan</dc:creator>
		<pubDate>Wed, 31 Oct 2012 12:50:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=525#comment-2813</guid>
		<description>Hi Derick - 
Thanks for the great article! Could you talk a little bit about directly accessing a route from the `href` tag? I know that your code snippet is a distillation of a more complex application, But I&#039;m wondering if you could have, in this instance, created the route directly in an HTML template?

eg. &lt;a href=&quot;#posts/&quot;&gt;&lt;/a&gt;

In other words, why do you need to bind this link in the javascript code at all? What are the advantages/disadvantages of this method?</description>
		<content:encoded><![CDATA[<p>Hi Derick &#8211;<br />
Thanks for the great article! Could you talk a little bit about directly accessing a route from the `href` tag? I know that your code snippet is a distillation of a more complex application, But I&#8217;m wondering if you could have, in this instance, created the route directly in an HTML template?</p>
<p>eg. &lt;a href=&quot;#posts/&#8221;&gt;</p>
<p>In other words, why do you need to bind this link in the javascript code at all? What are the advantages/disadvantages of this method?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derick Bailey</title>
		<link>http://lostechies.com/derickbailey/2011/08/28/dont-execute-a-backbone-js-route-handler-from-your-code/#comment-2496</link>
		<dc:creator>Derick Bailey</dc:creator>
		<pubDate>Wed, 30 May 2012 21:07:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=525#comment-2496</guid>
		<description>I think we&#039;re both heading in the same direction and the implementation here is pretty lousy for all the reasons you pointed out. the premise of not using a router to navigate and not using a router as a controller still stand firm, but the implementation and example code in this post is outdated for sure.

I&#039;ve moved well beyond this example code and am doing much more controller-like implementations now, starting with http://lostechies.com/derickbailey/2012/01/02/reducing-backbone-routers-to-nothing-more-than-configuration/

but I&#039;ve also moved further along with the implementation of modules that i&#039;m using, and having a module-controller per module, which handles all the work flow within a module. i havent&#039; blogged about this yet, but it&#039;s something i&#039;ve been doing in recent apps and i really like the way it works.</description>
		<content:encoded><![CDATA[<p>I think we&#8217;re both heading in the same direction and the implementation here is pretty lousy for all the reasons you pointed out. the premise of not using a router to navigate and not using a router as a controller still stand firm, but the implementation and example code in this post is outdated for sure.</p>
<p>I&#8217;ve moved well beyond this example code and am doing much more controller-like implementations now, starting with http://lostechies.com/derickbailey/2012/01/02/reducing-backbone-routers-to-nothing-more-than-configuration/</p>
<p>but I&#8217;ve also moved further along with the implementation of modules that i&#8217;m using, and having a module-controller per module, which handles all the work flow within a module. i havent&#8217; blogged about this yet, but it&#8217;s something i&#8217;ve been doing in recent apps and i really like the way it works.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brendan Delumpa</title>
		<link>http://lostechies.com/derickbailey/2011/08/28/dont-execute-a-backbone-js-route-handler-from-your-code/#comment-2495</link>
		<dc:creator>Brendan Delumpa</dc:creator>
		<pubDate>Wed, 30 May 2012 20:58:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=525#comment-2495</guid>
		<description>Derek, I read this article with great interest several months ago. I agree with your overall approach in your final solution, but disagree with using the router as a secondary controller. I know you&#039;ve cut out a lot of code for brevity, but the way you&#039;ve coupled the model with the router is a bit disconcerting to me. 

In lieu of that, an approach I&#039;ve taken to ensure that I have everything decoupled is to simply have the router trigger an event to which the application controller will respond and update the model(s) which in turn will update the view state. Conversely, a user clicking on a link, does nothing more than either updating its model, or triggering an event that the controller listens to, and it in turn instructs the router to update the URL. In either case, it boils down to a single point of control. 

So at least from my perspective, the router is simply a composite component with its own MVC within the context of an application controller. Its model being the browser history stack, the controller being the public API of the router, and the view being the URL. 

That&#039;s not to say you can&#039;t put all the controller functionality within the router - I&#039;ve seen that done as well, though not very cleanly - but my personal preference would be to relegate controller function to a custom controller object. 

In any case, don&#039;t know if any of this makes sense, but I&#039;ve used this pattern with great success.</description>
		<content:encoded><![CDATA[<p>Derek, I read this article with great interest several months ago. I agree with your overall approach in your final solution, but disagree with using the router as a secondary controller. I know you&#8217;ve cut out a lot of code for brevity, but the way you&#8217;ve coupled the model with the router is a bit disconcerting to me. </p>
<p>In lieu of that, an approach I&#8217;ve taken to ensure that I have everything decoupled is to simply have the router trigger an event to which the application controller will respond and update the model(s) which in turn will update the view state. Conversely, a user clicking on a link, does nothing more than either updating its model, or triggering an event that the controller listens to, and it in turn instructs the router to update the URL. In either case, it boils down to a single point of control. </p>
<p>So at least from my perspective, the router is simply a composite component with its own MVC within the context of an application controller. Its model being the browser history stack, the controller being the public API of the router, and the view being the URL. </p>
<p>That&#8217;s not to say you can&#8217;t put all the controller functionality within the router &#8211; I&#8217;ve seen that done as well, though not very cleanly &#8211; but my personal preference would be to relegate controller function to a custom controller object. </p>
<p>In any case, don&#8217;t know if any of this makes sense, but I&#8217;ve used this pattern with great success.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chandra</title>
		<link>http://lostechies.com/derickbailey/2011/08/28/dont-execute-a-backbone-js-route-handler-from-your-code/#comment-2443</link>
		<dc:creator>chandra</dc:creator>
		<pubDate>Fri, 11 May 2012 09:59:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derickbailey/?p=525#comment-2443</guid>
		<description>This is good, but what about when you have to wait for an asynchronous response when the user submits a form to change view, the router needs to wait for the async success callback to fire before routing to the new view. I read your articles, and I see they are very helpful. Thanks!</description>
		<content:encoded><![CDATA[<p>This is good, but what about when you have to wait for an asynchronous response when the user submits a form to change view, the router needs to wait for the async success callback to fire before routing to the new view. I read your articles, and I see they are very helpful. Thanks!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
