<?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: Strengthening your domain: The double dispatch pattern</title>
	<atom:link href="http://lostechies.com/jimmybogard/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/jimmybogard/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern/</link>
	<description>Strong opinions, weakly held</description>
	<lastBuildDate>Sun, 19 May 2013 03:22:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: matt kocaj</title>
		<link>http://lostechies.com/jimmybogard/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern/#comment-4598</link>
		<dc:creator>matt kocaj</dc:creator>
		<pubDate>Tue, 08 May 2012 07:21:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern.aspx#comment-4598</guid>
		<description>Since we&#039;re trying not to inject things into our model objects and we certainly don&#039;t want them concerned with knowing what a Repository is, then is a service (domain service) the appropriate place to have a Repository injected for acquiring items from other aggregates if that&#039;s the sort of logic that is required in some method of a domain object?</description>
		<content:encoded><![CDATA[<p>Since we&#8217;re trying not to inject things into our model objects and we certainly don&#8217;t want them concerned with knowing what a Repository is, then is a service (domain service) the appropriate place to have a Repository injected for acquiring items from other aggregates if that&#8217;s the sort of logic that is required in some method of a domain object?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ad</title>
		<link>http://lostechies.com/jimmybogard/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern/#comment-4326</link>
		<dc:creator>Ad</dc:creator>
		<pubDate>Tue, 14 Feb 2012 21:33:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern.aspx#comment-4326</guid>
		<description> In a perfect world, I think constructor DI would be the best option, but given technical limitations (ie how ORMs handle non-default contructors, etc) I think the method injection is the best, simplest approach. I&#039;d agree with @Krzysztof --this is Strategy Pattern...</description>
		<content:encoded><![CDATA[<p> In a perfect world, I think constructor DI would be the best option, but given technical limitations (ie how ORMs handle non-default contructors, etc) I think the method injection is the best, simplest approach. I&#8217;d agree with @Krzysztof &#8211;this is Strategy Pattern&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern/#comment-2288</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Fri, 11 Feb 2011 13:49:53 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern.aspx#comment-2288</guid>
		<description>@Bhoomi

Whoever calls this method is responsible for passing it in.  Typically, it&#039;s the container that builds this up, then a calling service that passes it in.</description>
		<content:encoded><![CDATA[<p>@Bhoomi</p>
<p>Whoever calls this method is responsible for passing it in.  Typically, it&#8217;s the container that builds this up, then a calling service that passes it in.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bhoomi</title>
		<link>http://lostechies.com/jimmybogard/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern/#comment-2287</link>
		<dc:creator>Bhoomi</dc:creator>
		<pubDate>Fri, 11 Feb 2011 10:50:18 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern.aspx#comment-2287</guid>
		<description>Great post.

&quot;RecordPayment&quot; is passed in IBalanceCalculator instance.
Who creates IBalanceCalculator instance?
</description>
		<content:encoded><![CDATA[<p>Great post.</p>
<p>&#8220;RecordPayment&#8221; is passed in IBalanceCalculator instance.<br />
Who creates IBalanceCalculator instance?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern/#comment-2286</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Mon, 31 Jan 2011 13:53:20 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern.aspx#comment-2286</guid>
		<description>@chandra

I find the design to be less-intention revealing that way.  In his example, setter injection is used to supply the service.  This leads to several design issues:

- It&#039;s possible to construct the object without the required services
- It&#039;s not clear which operations on the domain object use which services.  The signature of the method does not expose which services are needed
- If you use constructor injection, you&#039;re now required to supply _all_ services for _all_ operations, even though you might be only using one operation at a time.

That&#039;s why I find double-dispatch to be the most intention-revealing interface - it&#039;s part of the signature of the method of what exactly this operation requires to execute correctly.</description>
		<content:encoded><![CDATA[<p>@chandra</p>
<p>I find the design to be less-intention revealing that way.  In his example, setter injection is used to supply the service.  This leads to several design issues:</p>
<p>- It&#8217;s possible to construct the object without the required services<br />
- It&#8217;s not clear which operations on the domain object use which services.  The signature of the method does not expose which services are needed<br />
- If you use constructor injection, you&#8217;re now required to supply _all_ services for _all_ operations, even though you might be only using one operation at a time.</p>
<p>That&#8217;s why I find double-dispatch to be the most intention-revealing interface &#8211; it&#8217;s part of the signature of the method of what exactly this operation requires to execute correctly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chandra</title>
		<link>http://lostechies.com/jimmybogard/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern/#comment-2285</link>
		<dc:creator>chandra</dc:creator>
		<pubDate>Sun, 30 Jan 2011 21:54:41 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern.aspx#comment-2285</guid>
		<description>i am not able to justify whether to use dependency injection or double dispatch, your blog says to use double dispatch but if you go in the below link http://danhaywood.com/2010/04/30/accessing-domain-services-from-entities/ you will find he is against double dispatching and stress on dependency injection which you are against of.

On that blog it is wriitten that ,

&quot;
This design works well enough when the entity is called by the application layer; the application layer can easily access all the domain services, and so can pass in the appropriate service. If the entity is called by another entity then it’s more problematic, because the calling entity will in turn need to be passed in that entity, and transitively all the way back to the original call from the application layer.
So I’m not keen on this design, because it in effect exposes implementation details to the caller &quot;


Now who will you justify the above statement ?</description>
		<content:encoded><![CDATA[<p>i am not able to justify whether to use dependency injection or double dispatch, your blog says to use double dispatch but if you go in the below link <a href="http://danhaywood.com/2010/04/30/accessing-domain-services-from-entities/" rel="nofollow">http://danhaywood.com/2010/04/30/accessing-domain-services-from-entities/</a> you will find he is against double dispatching and stress on dependency injection which you are against of.</p>
<p>On that blog it is wriitten that ,</p>
<p>&#8221;<br />
This design works well enough when the entity is called by the application layer; the application layer can easily access all the domain services, and so can pass in the appropriate service. If the entity is called by another entity then it’s more problematic, because the calling entity will in turn need to be passed in that entity, and transitively all the way back to the original call from the application layer.<br />
So I’m not keen on this design, because it in effect exposes implementation details to the caller &#8221;</p>
<p>Now who will you justify the above statement ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bogardj</title>
		<link>http://lostechies.com/jimmybogard/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern/#comment-2284</link>
		<dc:creator>bogardj</dc:creator>
		<pubDate>Mon, 27 Sep 2010 03:24:46 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern.aspx#comment-2284</guid>
		<description>@Joseph, ashic

You&#039;re both wrong, it&#039;s the double distrategisitor pattern!  Anyway, this is the term used for this pattern on the DDD lists.  If it&#039;s confusing, apologies.</description>
		<content:encoded><![CDATA[<p>@Joseph, ashic</p>
<p>You&#8217;re both wrong, it&#8217;s the double distrategisitor pattern!  Anyway, this is the term used for this pattern on the DDD lists.  If it&#8217;s confusing, apologies.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ashic</title>
		<link>http://lostechies.com/jimmybogard/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern/#comment-2283</link>
		<dc:creator>ashic</dc:creator>
		<pubDate>Sun, 26 Sep 2010 16:27:56 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern.aspx#comment-2283</guid>
		<description>Just arrived here from derick&#039;s blog...and have to agree with Joseph. While reading the post I kept thinking &quot;hang on, this is the visitor pattern&quot;.</description>
		<content:encoded><![CDATA[<p>Just arrived here from derick&#8217;s blog&#8230;and have to agree with Joseph. While reading the post I kept thinking &#8220;hang on, this is the visitor pattern&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joseph</title>
		<link>http://lostechies.com/jimmybogard/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern/#comment-2282</link>
		<dc:creator>Joseph</dc:creator>
		<pubDate>Thu, 26 Aug 2010 10:28:07 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern.aspx#comment-2282</guid>
		<description>This is not double dispatch.  A single dispatch &quot;pattern&quot; selects a method depending on the name of the method and the type of the reciever (here, IBalanceCalculator).  A double dispatch &quot;pattern&quot; selects a method depending on the name of the method and the type of two receivers.  That is, the correct method is selected only after the executed has determined the correct dynamically bound method depending on the two receivers.  In this example, we do not have a method selection based on two receivers, therefore, it is not a double dispatch.

Moreover, double dispatch is not a pattern, but an implementation technique to realize various patterns such as the visitor pattern.

I can highly recommend everybody to look at &quot;Design Patterns - Elements of Reusable Object-Oriented Software&quot;.  Specifically, chapter 5, Visitor Pattern, pages 338-339.</description>
		<content:encoded><![CDATA[<p>This is not double dispatch.  A single dispatch &#8220;pattern&#8221; selects a method depending on the name of the method and the type of the reciever (here, IBalanceCalculator).  A double dispatch &#8220;pattern&#8221; selects a method depending on the name of the method and the type of two receivers.  That is, the correct method is selected only after the executed has determined the correct dynamically bound method depending on the two receivers.  In this example, we do not have a method selection based on two receivers, therefore, it is not a double dispatch.</p>
<p>Moreover, double dispatch is not a pattern, but an implementation technique to realize various patterns such as the visitor pattern.</p>
<p>I can highly recommend everybody to look at &#8220;Design Patterns &#8211; Elements of Reusable Object-Oriented Software&#8221;.  Specifically, chapter 5, Visitor Pattern, pages 338-339.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stu</title>
		<link>http://lostechies.com/jimmybogard/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern/#comment-2281</link>
		<dc:creator>Stu</dc:creator>
		<pubDate>Wed, 30 Jun 2010 14:11:25 +0000</pubDate>
		<guid isPermaLink="false">/blogs/jimmy_bogard/archive/2010/03/30/strengthening-your-domain-the-double-dispatch-pattern.aspx#comment-2281</guid>
		<description>Hi,

I have a problem that I&#039;ve explained on Stack Overflow. Basically I have a situation where neither double dispatch or domain events seem to fit properly. Does anyone have any suggestions?

http://stackoverflow.com/questions/3148853/service-behaviour-in-entity-how-to-avoid-service-injection-into-entity</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I have a problem that I&#8217;ve explained on Stack Overflow. Basically I have a situation where neither double dispatch or domain events seem to fit properly. Does anyone have any suggestions?</p>
<p><a href="http://stackoverflow.com/questions/3148853/service-behaviour-in-entity-how-to-avoid-service-injection-into-entity" rel="nofollow">http://stackoverflow.com/questions/3148853/service-behaviour-in-entity-how-to-avoid-service-injection-into-entity</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
