<?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: The Component Burden</title>
	<atom:link href="http://davybrion.com/blog/2008/12/the-component-burden/feed/" rel="self" type="application/rss+xml" />
	<link>http://davybrion.com/blog/2008/12/the-component-burden/</link>
	<description>Trying to walk that thin line between intelligence and ignorance</description>
	<lastBuildDate>Thu, 29 Jul 2010 20:54:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: hammett</title>
		<link>http://davybrion.com/blog/2008/12/the-component-burden/comment-page-1/#comment-6555</link>
		<dc:creator>hammett</dc:creator>
		<pubDate>Wed, 17 Dec 2008 21:28:39 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=722#comment-6555</guid>
		<description>Containers are the natural scope of components. Calling release will allow early disposal of a graph - it is a shortcut to reclaim resources early - and this should only be called by whomever deals with the container directly, not deep in the graph...

Given that any application will at some point have a reference to the container, get something from it, do some work and know that the component is not needed anymore, calling Release is natural for the app code (not domain or services, though). Sure, easy to forget. But as easy as forgetting to scope containers... The use of using a syntax sugar that might be worthwhile to add to windsor too. Will consider that.

Agreed that if you&#039;re composing manually you know what is disposable or not. IoC containers could do the same thing by transferring ownership of dependencies to defendants which would force you to virally make your own types in the graph disposable if you happen to have a disposable type down in the graph. That is where I think IoC container provide two key benefits

- it manages the ownership on your behalf
- given that an interface/contract does not implement IDisposable but an implementation does, the container would be the middle man that know this otherwise hidden detail. bring proxies to the table and it gets even more interesting

The same child container would also work with windsor, but would require a different strategy to register the right types on the right points of the hierarchy - which is something that PicoContainer does too.

Yep, the MEF lifetime team (which I belong to) has put a lot of effort to balance all the options and provide solutions for key scenarios. The code should be available soon, hope you all like it :-)</description>
		<content:encoded><![CDATA[<p>Containers are the natural scope of components. Calling release will allow early disposal of a graph &#8211; it is a shortcut to reclaim resources early &#8211; and this should only be called by whomever deals with the container directly, not deep in the graph&#8230;</p>
<p>Given that any application will at some point have a reference to the container, get something from it, do some work and know that the component is not needed anymore, calling Release is natural for the app code (not domain or services, though). Sure, easy to forget. But as easy as forgetting to scope containers&#8230; The use of using a syntax sugar that might be worthwhile to add to windsor too. Will consider that.</p>
<p>Agreed that if you&#8217;re composing manually you know what is disposable or not. IoC containers could do the same thing by transferring ownership of dependencies to defendants which would force you to virally make your own types in the graph disposable if you happen to have a disposable type down in the graph. That is where I think IoC container provide two key benefits</p>
<p>- it manages the ownership on your behalf<br />
- given that an interface/contract does not implement IDisposable but an implementation does, the container would be the middle man that know this otherwise hidden detail. bring proxies to the table and it gets even more interesting</p>
<p>The same child container would also work with windsor, but would require a different strategy to register the right types on the right points of the hierarchy &#8211; which is something that PicoContainer does too.</p>
<p>Yep, the MEF lifetime team (which I belong to) has put a lot of effort to balance all the options and provide solutions for key scenarios. The code should be available soon, hope you all like it <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bryan Watts</title>
		<link>http://davybrion.com/blog/2008/12/the-component-burden/comment-page-1/#comment-6505</link>
		<dc:creator>Bryan Watts</dc:creator>
		<pubDate>Wed, 17 Dec 2008 00:07:11 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=722#comment-6505</guid>
		<description>@Hammett,

I appreciate your response. I had a chance to talk with Nick at PDC; we discussed lifetimes and container hierarchies and he intrigued me with the possibilities.

By &quot;demands diligence&quot; I simply meant there is an extra step which is easy to forget. I agree the same issue exists with disposable types, though the contours are different.

When you directly create your dependencies, you&#039;re most likely to control their lifetimes because they are variables. There is no ambiguity: wrap that shiny new object in a using statement, or dispose it alongside yourself.

Explicit release requires knowledge of the container. Components shouldn&#039;t know about the container, so that gap must be bridged somewhere. This is the point at which I am still fuzzy, and would appreciate guidance.

The issue seems to be scope: variables have well-defined scopes, but components in a container do not. That disparity is addressed by the unit-of-work, a natural scope.

I realize more thought has been put into this by the MEF team than could possibly be quantified. The points above are where I get stuck.</description>
		<content:encoded><![CDATA[<p>@Hammett,</p>
<p>I appreciate your response. I had a chance to talk with Nick at PDC; we discussed lifetimes and container hierarchies and he intrigued me with the possibilities.</p>
<p>By &#8220;demands diligence&#8221; I simply meant there is an extra step which is easy to forget. I agree the same issue exists with disposable types, though the contours are different.</p>
<p>When you directly create your dependencies, you&#8217;re most likely to control their lifetimes because they are variables. There is no ambiguity: wrap that shiny new object in a using statement, or dispose it alongside yourself.</p>
<p>Explicit release requires knowledge of the container. Components shouldn&#8217;t know about the container, so that gap must be bridged somewhere. This is the point at which I am still fuzzy, and would appreciate guidance.</p>
<p>The issue seems to be scope: variables have well-defined scopes, but components in a container do not. That disparity is addressed by the unit-of-work, a natural scope.</p>
<p>I realize more thought has been put into this by the MEF team than could possibly be quantified. The points above are where I get stuck.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hammett</title>
		<link>http://davybrion.com/blog/2008/12/the-component-burden/comment-page-1/#comment-6459</link>
		<dc:creator>hammett</dc:creator>
		<pubDate>Mon, 15 Dec 2008 18:53:43 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=722#comment-6459</guid>
		<description>@Bryan,
Not sure I follow: &#039;demands diligence&#039;? As much as disposable types demands to be disposed. 

I work with Nick from Autofac, and as much as I understand the child/scoped containers approach it has pros and cons as everything. There&#039;s no such thing as the perfect design.</description>
		<content:encoded><![CDATA[<p>@Bryan,<br />
Not sure I follow: &#8216;demands diligence&#8217;? As much as disposable types demands to be disposed. </p>
<p>I work with Nick from Autofac, and as much as I understand the child/scoped containers approach it has pros and cons as everything. There&#8217;s no such thing as the perfect design.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dew Drop - December 15, 2008 &#124; Alvin Ashcraft's Morning Dew</title>
		<link>http://davybrion.com/blog/2008/12/the-component-burden/comment-page-1/#comment-6451</link>
		<dc:creator>Dew Drop - December 15, 2008 &#124; Alvin Ashcraft's Morning Dew</dc:creator>
		<pubDate>Mon, 15 Dec 2008 14:11:22 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=722#comment-6451</guid>
		<description>[...] The Component Burden (Davy Brion) [...]</description>
		<content:encoded><![CDATA[<p>[...] The Component Burden (Davy Brion) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Degosserie</title>
		<link>http://davybrion.com/blog/2008/12/the-component-burden/comment-page-1/#comment-6439</link>
		<dc:creator>Steve Degosserie</dc:creator>
		<pubDate>Mon, 15 Dec 2008 07:57:45 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=722#comment-6439</guid>
		<description>Another interesting article, although MEF-related, on the subject:
http://hammett.castleproject.org/?p=326</description>
		<content:encoded><![CDATA[<p>Another interesting article, although MEF-related, on the subject:<br />
<a href="http://hammett.castleproject.org/?p=326" rel="nofollow">http://hammett.castleproject.org/?p=326</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bryan Watts</title>
		<link>http://davybrion.com/blog/2008/12/the-component-burden/comment-page-1/#comment-6428</link>
		<dc:creator>Bryan Watts</dc:creator>
		<pubDate>Mon, 15 Dec 2008 01:04:40 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=722#comment-6428</guid>
		<description>Windsor demands diligence, as highlighted by your original post. It certainly doesn&#039;t drop you in the pit of success.

&quot;Nested containers&quot; is an overloaded concept. A &quot;unit of work&quot; is a richer perspective - it is a natural scope for transient instances. In the same way, a root container is a natural scope for singletons.

The structure of the dependencies must make sense (i.e. not be &quot;dangerous&quot;), but the cleanliness of the solution leads me to believe it has merit.</description>
		<content:encoded><![CDATA[<p>Windsor demands diligence, as highlighted by your original post. It certainly doesn&#8217;t drop you in the pit of success.</p>
<p>&#8220;Nested containers&#8221; is an overloaded concept. A &#8220;unit of work&#8221; is a richer perspective &#8211; it is a natural scope for transient instances. In the same way, a root container is a natural scope for singletons.</p>
<p>The structure of the dependencies must make sense (i.e. not be &#8220;dangerous&#8221;), but the cleanliness of the solution leads me to believe it has merit.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2008/12/the-component-burden/comment-page-1/#comment-6419</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Sun, 14 Dec 2008 19:06:55 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=722#comment-6419</guid>
		<description>it&#039;s interesting, although i&#039;m not sure what to think of the inner-container based approach. It surely makes it easier for autofac to keep track of created references and properly disposing of them. 

I have no experience with autofac, so i&#039;m not sure if you&#039;re always supposed to use nested containers or not, but if you&#039;re able to resolve components both through the root container and nested containers, it seems a bit &#039;dangerous&#039; to me. Ideally, i&#039;d like my code to know as little as possible about the IoC container.  The solution that the Castle guys implemented seems to make that make that possible without having to decide between root containers or nested containers.</description>
		<content:encoded><![CDATA[<p>it&#8217;s interesting, although i&#8217;m not sure what to think of the inner-container based approach. It surely makes it easier for autofac to keep track of created references and properly disposing of them. </p>
<p>I have no experience with autofac, so i&#8217;m not sure if you&#8217;re always supposed to use nested containers or not, but if you&#8217;re able to resolve components both through the root container and nested containers, it seems a bit &#8216;dangerous&#8217; to me. Ideally, i&#8217;d like my code to know as little as possible about the IoC container.  The solution that the Castle guys implemented seems to make that make that possible without having to decide between root containers or nested containers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bryan Watts</title>
		<link>http://davybrion.com/blog/2008/12/the-component-burden/comment-page-1/#comment-6418</link>
		<dc:creator>Bryan Watts</dc:creator>
		<pubDate>Sun, 14 Dec 2008 18:42:37 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=722#comment-6418</guid>
		<description>Thank you for your in-depth reply. This is indeed a difficult logical issue.

You addressed the main implication of my comment, which is that components must have contextual knowledge of their use. This effectively couples components to particular DI paradigms.

It seems intuitive that an IoC container, which creates instances, would also dispose of them. Have you seen &lt;a href=&quot;http://code.google.com/p/autofac/wiki/DeterministicDisposal&quot; rel=&quot;nofollow&quot;&gt;Autofac Deterministic Disposal&quot;&lt;/a&gt;? What is your opinion of that approach?</description>
		<content:encoded><![CDATA[<p>Thank you for your in-depth reply. This is indeed a difficult logical issue.</p>
<p>You addressed the main implication of my comment, which is that components must have contextual knowledge of their use. This effectively couples components to particular DI paradigms.</p>
<p>It seems intuitive that an IoC container, which creates instances, would also dispose of them. Have you seen <a href="http://code.google.com/p/autofac/wiki/DeterministicDisposal" rel="nofollow">Autofac Deterministic Disposal&#8221;</a>? What is your opinion of that approach?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hammett</title>
		<link>http://davybrion.com/blog/2008/12/the-component-burden/comment-page-1/#comment-6415</link>
		<dc:creator>hammett</dc:creator>
		<pubDate>Sun, 14 Dec 2008 18:06:24 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=722#comment-6415</guid>
		<description>Great stuff. I&#039;d also recommend skepticism towards the latest implementation, but so far I&#039;ve only heard about one minor side effect.</description>
		<content:encoded><![CDATA[<p>Great stuff. I&#8217;d also recommend skepticism towards the latest implementation, but so far I&#8217;ve only heard about one minor side effect.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
