<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Focusing on the controller&#039;s responsibility</title>
	<atom:link href="http://mhinze.com/2010/04/20/focusing-on-the-controllers-responsibility/feed/" rel="self" type="application/rss+xml" />
	<link>http://mhinze.com/2010/04/20/focusing-on-the-controllers-responsibility/</link>
	<description>Matt Hinze, learning in public</description>
	<lastBuildDate>Fri, 18 May 2012 15:09:42 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: mfalanga</title>
		<link>http://mhinze.com/2010/04/20/focusing-on-the-controllers-responsibility/#comment-148</link>
		<dc:creator><![CDATA[mfalanga]]></dc:creator>
		<pubDate>Thu, 22 Apr 2010 19:42:03 +0000</pubDate>
		<guid isPermaLink="false">http://mhinze.com/focusing-on-the-controllers-responsibility/#comment-148</guid>
		<description><![CDATA[@ryzam,

For me, it comes down to two things: 1) being DRY, and 2) testability.  If I find that I have to write that same query again, I will refactor so that it&#039;s in one place.  For testability, if I go through another layer of abstraction, I can mock out that layer to make sure that my controller is working properly.  In Matt&#039;s example, I can mock out the Ship method to return different statuses, and ensure that my controller is redirecting how it is supposed to.]]></description>
		<content:encoded><![CDATA[<p>@ryzam,</p>
<p>For me, it comes down to two things: 1) being DRY, and 2) testability.  If I find that I have to write that same query again, I will refactor so that it&#8217;s in one place.  For testability, if I go through another layer of abstraction, I can mock out that layer to make sure that my controller is working properly.  In Matt&#8217;s example, I can mock out the Ship method to return different statuses, and ensure that my controller is redirecting how it is supposed to.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dew Drop &#8211; April 21, 2010 &#124; Alvin Ashcraft&#039;s Morning Dew</title>
		<link>http://mhinze.com/2010/04/20/focusing-on-the-controllers-responsibility/#comment-147</link>
		<dc:creator><![CDATA[Dew Drop &#8211; April 21, 2010 &#124; Alvin Ashcraft&#039;s Morning Dew]]></dc:creator>
		<pubDate>Wed, 21 Apr 2010 12:28:04 +0000</pubDate>
		<guid isPermaLink="false">http://mhinze.com/focusing-on-the-controllers-responsibility/#comment-147</guid>
		<description><![CDATA[[...] Focusing on the controller’s responsibility (Matt Hinze) [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Focusing on the controller’s responsibility (Matt Hinze) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ryzam</title>
		<link>http://mhinze.com/2010/04/20/focusing-on-the-controllers-responsibility/#comment-146</link>
		<dc:creator><![CDATA[ryzam]]></dc:creator>
		<pubDate>Wed, 21 Apr 2010 06:00:17 +0000</pubDate>
		<guid isPermaLink="false">http://mhinze.com/focusing-on-the-controllers-responsibility/#comment-146</guid>
		<description><![CDATA[But actually I don&#039;t see much benefit to have another abstraction layer for query a record. I can agree if we want execute a command then it will go through appropriate layer, but for query why don&#039;t we query direct using linq or what ever technology (NHibernate, EF) etc]]></description>
		<content:encoded><![CDATA[<p>But actually I don&#8217;t see much benefit to have another abstraction layer for query a record. I can agree if we want execute a command then it will go through appropriate layer, but for query why don&#8217;t we query direct using linq or what ever technology (NHibernate, EF) etc</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://mhinze.com/2010/04/20/focusing-on-the-controllers-responsibility/#comment-145</link>
		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Wed, 21 Apr 2010 04:47:32 +0000</pubDate>
		<guid isPermaLink="false">http://mhinze.com/focusing-on-the-controllers-responsibility/#comment-145</guid>
		<description><![CDATA[@ryzam

This is annoying, but it depends.  If the semantics of the linq query are clear and it&#039;s concise.. why not use it?  I think I would default to the linq query.. but there&#039;s a pain/maintainability threshold that will be met soon in a larger project.  And so I&#039;d keep an eye on that.  I think in the next year or so we&#039;ll see an alternative that is something like query object (but not query object) that we might like better than the OCP-violating repository methods.]]></description>
		<content:encoded><![CDATA[<p>@ryzam</p>
<p>This is annoying, but it depends.  If the semantics of the linq query are clear and it&#8217;s concise.. why not use it?  I think I would default to the linq query.. but there&#8217;s a pain/maintainability threshold that will be met soon in a larger project.  And so I&#8217;d keep an eye on that.  I think in the next year or so we&#8217;ll see an alternative that is something like query object (but not query object) that we might like better than the OCP-violating repository methods.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Focusing on the controller’s responsibility &#171; Huy Nguyen&#039;s Blog</title>
		<link>http://mhinze.com/2010/04/20/focusing-on-the-controllers-responsibility/#comment-144</link>
		<dc:creator><![CDATA[Focusing on the controller’s responsibility &#171; Huy Nguyen&#039;s Blog]]></dc:creator>
		<pubDate>Wed, 21 Apr 2010 03:54:00 +0000</pubDate>
		<guid isPermaLink="false">http://mhinze.com/focusing-on-the-controllers-responsibility/#comment-144</guid>
		<description><![CDATA[[...] Focusing on the controller’s&#160;responsibility  April 21, 2010 huyrua Leave a comment Go to comments    This morning I came across an interesting article about Controller responsibility: http://mhinze.com/focusing-on-the-controllers-responsibility/ [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Focusing on the controller’s&nbsp;responsibility  April 21, 2010 huyrua Leave a comment Go to comments    This morning I came across an interesting article about Controller responsibility: http://mhinze.com/focusing-on-the-controllers-responsibility/ [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ryzam</title>
		<link>http://mhinze.com/2010/04/20/focusing-on-the-controllers-responsibility/#comment-143</link>
		<dc:creator><![CDATA[ryzam]]></dc:creator>
		<pubDate>Wed, 21 Apr 2010 03:47:06 +0000</pubDate>
		<guid isPermaLink="false">http://mhinze.com/focusing-on-the-controllers-responsibility/#comment-143</guid>
		<description><![CDATA[I have a question on how you use a controller as a query gateway. Do you delegate that to a service or you use controller to direct query into database?

public JsonResult FindShipsByOrderId(int orderId)
{
    return s.Linq().Where(....).Select(c=&gt; new { ShipId= c.shipId, ...});
}

or

public JsonResult FindShipsByOrderId(int orderId)
{
    return orderShippingService.FindShipsByOrderId(orderId);
}]]></description>
		<content:encoded><![CDATA[<p>I have a question on how you use a controller as a query gateway. Do you delegate that to a service or you use controller to direct query into database?</p>
<p>public JsonResult FindShipsByOrderId(int orderId)<br />
{<br />
    return s.Linq().Where(&#8230;.).Select(c=&gt; new { ShipId= c.shipId, &#8230;});<br />
}</p>
<p>or</p>
<p>public JsonResult FindShipsByOrderId(int orderId)<br />
{<br />
    return orderShippingService.FindShipsByOrderId(orderId);<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

