<?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: Inversion Of Control Containers And Factories Aren&#8217;t Mutually Exclusive</title> <atom:link href="http://davybrion.com/blog/2010/01/inversion-of-control-containers-and-factories-arent-mutually-exclusive/feed/" rel="self" type="application/rss+xml" /><link>http://davybrion.com/blog/2010/01/inversion-of-control-containers-and-factories-arent-mutually-exclusive/</link> <description>inquisitive: adjective. given to inquiry, research, or asking questions; eager for knowledge; intellectually curious</description> <lastBuildDate>Wed, 08 Feb 2012 11:42:42 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Nicholas Blumhardt</title><link>http://davybrion.com/blog/2010/01/inversion-of-control-containers-and-factories-arent-mutually-exclusive/comment-page-1/#comment-26115</link> <dc:creator>Nicholas Blumhardt</dc:creator> <pubDate>Mon, 25 Jan 2010 12:50:47 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2224#comment-26115</guid> <description>@Davy interestingly, if we invert the relationship between Agatha and the container :) then using an automatically-implemented interface or Func would aid portability.The big hurdle is getting an inverted &quot;Common Service Locator&quot; happening. Just wrote about this (in perhaps too much detail) here: http://nblumhardt.com/2010/01/the-relationship-zoo/ - hope this makes some sense in your scenario, as frameworks like Agatha would be a primary consumer.</description> <content:encoded><![CDATA[<p>@Davy interestingly, if we invert the relationship between Agatha and the container <img
src='http://d18sni7re4ly7f.cloudfront.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> then using an automatically-implemented interface or Func would aid portability.</p><p>The big hurdle is getting an inverted &#8220;Common Service Locator&#8221; happening. Just wrote about this (in perhaps too much detail) here: <a
href="http://nblumhardt.com/2010/01/the-relationship-zoo/" rel="nofollow">http://nblumhardt.com/2010/01/the-relationship-zoo/</a> &#8211; hope this makes some sense in your scenario, as frameworks like Agatha would be a primary consumer.</p> ]]></content:encoded> </item> <item><title>By: The Morning Brew - Chris Alcock &#187; The Morning Brew #524</title><link>http://davybrion.com/blog/2010/01/inversion-of-control-containers-and-factories-arent-mutually-exclusive/comment-page-1/#comment-26086</link> <dc:creator>The Morning Brew - Chris Alcock &#187; The Morning Brew #524</dc:creator> <pubDate>Mon, 25 Jan 2010 08:41:23 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2224#comment-26086</guid> <description>[...] Inversion Of Control Containers And Factories Aren&#8217;t Mutually Exclusive - Davy Brion picks up on some feedback about the use of Factories as a part of the DI debate, ans shows how he goes about using factories with Inversion of Control. [...]</description> <content:encoded><![CDATA[<p>[...] Inversion Of Control Containers And Factories Aren&#8217;t Mutually Exclusive &#8211; Davy Brion picks up on some feedback about the use of Factories as a part of the DI debate, ans shows how he goes about using factories with Inversion of Control. [...]</p> ]]></content:encoded> </item> <item><title>By: Davy Brion</title><link>http://davybrion.com/blog/2010/01/inversion-of-control-containers-and-factories-arent-mutually-exclusive/comment-page-1/#comment-25997</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Sun, 24 Jan 2010 10:03:38 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2224#comment-25997</guid> <description>@Krzysztof and @Nicholasi already know about those features, and think they&#039;re great :)but i can&#039;t use anything container-specific in Agatha since it needs to work with multiple containers...</description> <content:encoded><![CDATA[<p>@Krzysztof and @Nicholas</p><p>i already know about those features, and think they&#8217;re great <img
src='http://d18sni7re4ly7f.cloudfront.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p>but i can&#8217;t use anything container-specific in Agatha since it needs to work with multiple containers&#8230;</p> ]]></content:encoded> </item> <item><title>By: Davy Brion</title><link>http://davybrion.com/blog/2010/01/inversion-of-control-containers-and-factories-arent-mutually-exclusive/comment-page-1/#comment-25996</link> <dc:creator>Davy Brion</dc:creator> <pubDate>Sun, 24 Jan 2010 09:59:54 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2224#comment-25996</guid> <description>@Jeffreyi don&#039;t know how carefully you read this post but i really don&#039;t agree with Uncle Bob about the IOC thing _at all_.  He advocates using manual DI and when things get a bit more complex, to switch to factories.  Those factories that he suggests not only know about the dependencies of the classes they need to create, they&#039;re also responsible for the registration of them.  That&#039;s pretty much the exact opposite of the kind of factory i showed in this post.  And about not needing to represent factories as interfaces, i think we disagree on that as well.  My post clearly shows that the factory does implement an interface and that i have it injected in the class that needs instances created by the factory.  I even mention that this enables me to switch the implementation of both the factory, as well as the instances that are created.   I can&#039;t really think of any reason why i&#039;d want to new up a factory instance... i&#039;d have to have some kind of static hook into the factory to replace the type of the instance being created by the factory during tests.  Which is another thing that i&#039;m actively trying to avoid with DI.If you still think that i agree with Uncle Bob or with you about this whole thing, i&#039;d really like to see a more detailed explanation as to where you see the similarities in thoughts.   Because i really don&#039;t see them, quite the opposite in fact ;)</description> <content:encoded><![CDATA[<p>@Jeffrey</p><p>i don&#8217;t know how carefully you read this post but i really don&#8217;t agree with Uncle Bob about the IOC thing _at all_.  He advocates using manual DI and when things get a bit more complex, to switch to factories.  Those factories that he suggests not only know about the dependencies of the classes they need to create, they&#8217;re also responsible for the registration of them.  That&#8217;s pretty much the exact opposite of the kind of factory i showed in this post.  And about not needing to represent factories as interfaces, i think we disagree on that as well.  My post clearly shows that the factory does implement an interface and that i have it injected in the class that needs instances created by the factory.  I even mention that this enables me to switch the implementation of both the factory, as well as the instances that are created.   I can&#8217;t really think of any reason why i&#8217;d want to new up a factory instance&#8230; i&#8217;d have to have some kind of static hook into the factory to replace the type of the instance being created by the factory during tests.  Which is another thing that i&#8217;m actively trying to avoid with DI.</p><p>If you still think that i agree with Uncle Bob or with you about this whole thing, i&#8217;d really like to see a more detailed explanation as to where you see the similarities in thoughts.   Because i really don&#8217;t see them, quite the opposite in fact <img
src='http://d18sni7re4ly7f.cloudfront.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p> ]]></content:encoded> </item> <item><title>By: Nicholas Blumhardt</title><link>http://davybrion.com/blog/2010/01/inversion-of-control-containers-and-factories-arent-mutually-exclusive/comment-page-1/#comment-25958</link> <dc:creator>Nicholas Blumhardt</dc:creator> <pubDate>Sun, 24 Jan 2010 02:54:18 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2224#comment-25958</guid> <description>Or similarly with &lt;a href=&quot;http://autofac.org&quot; rel=&quot;nofollow&quot;&gt;Autofac&lt;/a&gt;, just use Func&lt;IAsyncRequestDispatcher&gt; and the container will automatically provide an implementation for you. Zero-friction :)</description> <content:encoded><![CDATA[<p>Or similarly with <a
href="http://autofac.org" rel="nofollow">Autofac</a>, just use Func&lt;IAsyncRequestDispatcher&gt; and the container will automatically provide an implementation for you. Zero-friction <img
src='http://d18sni7re4ly7f.cloudfront.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> </item> <item><title>By: Krzysztof Kozmic</title><link>http://davybrion.com/blog/2010/01/inversion-of-control-containers-and-factories-arent-mutually-exclusive/comment-page-1/#comment-25930</link> <dc:creator>Krzysztof Kozmic</dc:creator> <pubDate>Sat, 23 Jan 2010 19:58:04 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2224#comment-25930</guid> <description>Davy,Good point you have there. However, if you&#039;re using the factory just as a facade for the container, than why bother hand coding it?
In Windsor all you need is the interface &lt;i&gt;IAsyncRequestDispatcherFactory&lt;/i&gt; and you can have &lt;a href=&quot;http://using.castleproject.org/display/IoC/Typed+Factory+Facility&quot; rel=&quot;nofollow&quot;&gt;the container do the implementation for you&lt;/a&gt;.</description> <content:encoded><![CDATA[<p>Davy,</p><p>Good point you have there. However, if you&#8217;re using the factory just as a facade for the container, than why bother hand coding it?<br
/> In Windsor all you need is the interface <i>IAsyncRequestDispatcherFactory</i> and you can have <a
href="http://using.castleproject.org/display/IoC/Typed+Factory+Facility" rel="nofollow">the container do the implementation for you</a>.</p> ]]></content:encoded> </item> <item><title>By: Julian Birch</title><link>http://davybrion.com/blog/2010/01/inversion-of-control-containers-and-factories-arent-mutually-exclusive/comment-page-1/#comment-25929</link> <dc:creator>Julian Birch</dc:creator> <pubDate>Sat, 23 Jan 2010 19:54:46 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2224#comment-25929</guid> <description>Having seen your (very clear) example, I think we agree more than we disagree here.  I think probably our biggest disagreement is over how we interpreted Uncle Bob&#039;s original post, rather than what best practice is.  Your example is pretty much exactly the scenario/solution I was trying to describe.The only change I&#039;d make is to take the container as a constructor dependency rather that make it a global variable.  Jeffrey did something similar in his example, where he introduced a (to my mind) unnecessary global variable to abstract out the container.  I know it&#039;s rare to want a second container in the same process, but making it an instance isn&#039;t usually that hard.Thank you,Julian.</description> <content:encoded><![CDATA[<p>Having seen your (very clear) example, I think we agree more than we disagree here.  I think probably our biggest disagreement is over how we interpreted Uncle Bob&#8217;s original post, rather than what best practice is.  Your example is pretty much exactly the scenario/solution I was trying to describe.</p><p>The only change I&#8217;d make is to take the container as a constructor dependency rather that make it a global variable.  Jeffrey did something similar in his example, where he introduced a (to my mind) unnecessary global variable to abstract out the container.  I know it&#8217;s rare to want a second container in the same process, but making it an instance isn&#8217;t usually that hard.</p><p>Thank you,</p><p>Julian.</p> ]]></content:encoded> </item> <item><title>By: Mark Sargent</title><link>http://davybrion.com/blog/2010/01/inversion-of-control-containers-and-factories-arent-mutually-exclusive/comment-page-1/#comment-25921</link> <dc:creator>Mark Sargent</dc:creator> <pubDate>Sat, 23 Jan 2010 18:20:38 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2224#comment-25921</guid> <description>The current IoC hornets nest has provided plenty of reading.I have recently used the same approach as you in a project I am working on. Simply passing in the a dependency (a list of launch application buttons to show) did not fit as this would require either the container or the calling function (main) to assume responsibility for the contents. A factory made sense as this provided a single configuration point. The factory implementation simply called the container to resolve the specific button types and their dependencies.It was my tests that drove me to that decision, either too much setup, too much direct access to the container.The factory + container allows me to defer creation until I need it while simplifying my tests and the injected dependencies. I agree I can&#039;t see a downside.While calling the container directly is something that should be limited, it feels like a reasonable thing to do inside a factory class. Which after all that is its traditional role. Further more it has pushed the access to the container further to the edges of the design.</description> <content:encoded><![CDATA[<p>The current IoC hornets nest has provided plenty of reading.</p><p>I have recently used the same approach as you in a project I am working on. Simply passing in the a dependency (a list of launch application buttons to show) did not fit as this would require either the container or the calling function (main) to assume responsibility for the contents. A factory made sense as this provided a single configuration point. The factory implementation simply called the container to resolve the specific button types and their dependencies.</p><p>It was my tests that drove me to that decision, either too much setup, too much direct access to the container.</p><p>The factory + container allows me to defer creation until I need it while simplifying my tests and the injected dependencies. I agree I can&#8217;t see a downside.</p><p>While calling the container directly is something that should be limited, it feels like a reasonable thing to do inside a factory class. Which after all that is its traditional role. Further more it has pushed the access to the container further to the edges of the design.</p> ]]></content:encoded> </item> <item><title>By: Lasse Vågsæther Karlsen</title><link>http://davybrion.com/blog/2010/01/inversion-of-control-containers-and-factories-arent-mutually-exclusive/comment-page-1/#comment-25916</link> <dc:creator>Lasse Vågsæther Karlsen</dc:creator> <pubDate>Sat, 23 Jan 2010 17:08:17 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2224#comment-25916</guid> <description>Gah, in my comment above, the angle brackets was taken for tags, here&#039;s a repost. If you can delete the previous one, please do so.I&#039;ve solved a similar problem with my own IoC container. Every service you register will have a sibling service being registered that will resolve to IServiceFactory{ServiceInterfaceType}. So, if you register a service like IEmployeeRepository, another service for IServiceFactory{IEmployeeRepository} will be registered for you, automatically. If you resolve for the service, the container will go about its business as usual, but if you resolve the factory service, you can then later on resolve the actual service from that factory service. If the service isn&#039;t singleton, or container-scoped, you can also resolve it multiple times, for multiple instances.Since this is handled by my container automatically, I can use the factory service in constructor calls to my other services, and have the factory automatically injected for me. This way I can easily flag in the code that my service depends on another service, but it either has lazy-resolution scenarios, or multiple-resolution scenarios, without having to just inject the whole container.</description> <content:encoded><![CDATA[<p>Gah, in my comment above, the angle brackets was taken for tags, here&#8217;s a repost. If you can delete the previous one, please do so.</p><p>I&#8217;ve solved a similar problem with my own IoC container. Every service you register will have a sibling service being registered that will resolve to IServiceFactory{ServiceInterfaceType}. So, if you register a service like IEmployeeRepository, another service for IServiceFactory{IEmployeeRepository} will be registered for you, automatically. If you resolve for the service, the container will go about its business as usual, but if you resolve the factory service, you can then later on resolve the actual service from that factory service. If the service isn&#8217;t singleton, or container-scoped, you can also resolve it multiple times, for multiple instances.</p><p>Since this is handled by my container automatically, I can use the factory service in constructor calls to my other services, and have the factory automatically injected for me. This way I can easily flag in the code that my service depends on another service, but it either has lazy-resolution scenarios, or multiple-resolution scenarios, without having to just inject the whole container.</p> ]]></content:encoded> </item> <item><title>By: Jeffrey Palermo</title><link>http://davybrion.com/blog/2010/01/inversion-of-control-containers-and-factories-arent-mutually-exclusive/comment-page-1/#comment-25914</link> <dc:creator>Jeffrey Palermo</dc:creator> <pubDate>Sat, 23 Jan 2010 16:33:00 +0000</pubDate> <guid
isPermaLink="false">http://davybrion.com/blog/?p=2224#comment-25914</guid> <description>To me it sounds like you agree quite a bit with uncle bob. It certainly seems like we agree too since factories often don&#039;t need to be represented as interfaces.</description> <content:encoded><![CDATA[<p>To me it sounds like you agree quite a bit with uncle bob. It certainly seems like we agree too since factories often don&#8217;t need to be represented as interfaces.</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 3/15 queries in 0.008 seconds using disk: basic
Object Caching 483/486 objects using disk: basic
Content Delivery Network via Amazon Web Services: CloudFront: d18sni7re4ly7f.cloudfront.net

Served from: davybrion.com @ 2012-02-09 03:59:28 -->
