<?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: What&#8217;s Wrong With This Picture?</title>
	<atom:link href="http://davybrion.com/blog/2009/11/whats-wrong-with-this-picture-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://davybrion.com/blog/2009/11/whats-wrong-with-this-picture-2/</link>
	<description>Trying to walk that thin line between intelligence and ignorance</description>
	<lastBuildDate>Thu, 29 Jul 2010 20:29:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Awkward Coder</title>
		<link>http://davybrion.com/blog/2009/11/whats-wrong-with-this-picture-2/comment-page-1/#comment-23029</link>
		<dc:creator>Awkward Coder</dc:creator>
		<pubDate>Mon, 23 Nov 2009 11:45:20 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1937#comment-23029</guid>
		<description>Funny I was having trouble yesterday with a builder class for creating composite encrypted tokens - I need to be able to decompose said encrypted token and that doesn&#039;t sit right on a builder class. So I ended up renaming the class and defining seperate role interfaces.

Now it took me less than 2 minutes to come to this conclusion...

Just goes to show the P&amp;P team can&#039;t be bothered or can&#039;t be arsed with quality.

Ocne you realise EL is shite you never go back!</description>
		<content:encoded><![CDATA[<p>Funny I was having trouble yesterday with a builder class for creating composite encrypted tokens &#8211; I need to be able to decompose said encrypted token and that doesn&#8217;t sit right on a builder class. So I ended up renaming the class and defining seperate role interfaces.</p>
<p>Now it took me less than 2 minutes to come to this conclusion&#8230;</p>
<p>Just goes to show the P&amp;P team can&#8217;t be bothered or can&#8217;t be arsed with quality.</p>
<p>Ocne you realise EL is shite you never go back!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrey R.</title>
		<link>http://davybrion.com/blog/2009/11/whats-wrong-with-this-picture-2/comment-page-1/#comment-23028</link>
		<dc:creator>Andrey R.</dc:creator>
		<pubDate>Mon, 23 Nov 2009 09:21:12 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1937#comment-23028</guid>
		<description>Thanks for the explanation.

#1 - I guess that is because under covers they use ObjectBuilder, which was invented at times when nobody was thinking about SOLID principles. ObjectBuilder is core of EL, so even if at some point they realized the problem, they probably didn&#039;t want to introduce breaking changes. As far as I know they were going to get rid of OB in EL 5.0 and, in fact, latest changeset on codeplex shows that the Teardown method is no longer uses Builder class (though it uses BuilderContext :))

#2,3 - I agree, it is quite confusing to get ResolutionFailed while calling something that is not directly related to resolution. The principle was probably same as for Builder class - it can only throw BuildFailedExceptions, UnityContainer can only throw ResolutionFailedExceptions.</description>
		<content:encoded><![CDATA[<p>Thanks for the explanation.</p>
<p>#1 &#8211; I guess that is because under covers they use ObjectBuilder, which was invented at times when nobody was thinking about SOLID principles. ObjectBuilder is core of EL, so even if at some point they realized the problem, they probably didn&#8217;t want to introduce breaking changes. As far as I know they were going to get rid of OB in EL 5.0 and, in fact, latest changeset on codeplex shows that the Teardown method is no longer uses Builder class (though it uses BuilderContext <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )</p>
<p>#2,3 &#8211; I agree, it is quite confusing to get ResolutionFailed while calling something that is not directly related to resolution. The principle was probably same as for Builder class &#8211; it can only throw BuildFailedExceptions, UnityContainer can only throw ResolutionFailedExceptions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2009/11/whats-wrong-with-this-picture-2/comment-page-1/#comment-23027</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Mon, 23 Nov 2009 08:26:02 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1937#comment-23027</guid>
		<description>1) the code indicates that the Builder type has way too many responsibilities... why should you use a &#039;Builder&#039; to &#039;tear down&#039; an object? I assume the Builder class contains most of the code to resolve associations between dependencies, which is indeed needed for tearing down an object graph.  Constructing an object graph and tearing it down are two entirely different matters, especially in the context of an IOC container and it really shouldn&#039;t be contained in one central piece. It just indicates that the Builder class is responsible for waaaay too many things

2) If the teardown method of the Builder fails, it throws a BuildFailedException, which indicates that the Builder in general only throws BuildFailedExceptions instead of exceptions that are relevant for what actually happened. Don&#039;t you think it would be confusing if you were to get a BuildFailedException when you are _tearing down_ an object?

3) The UnityContainer automatically wraps that BuildFailedException into a ResolutionFailedException. What if the Teardown method failed for different reasons? Suppose that my object and its dependencies couldn&#039;t be cleaned up properly for whatever reason that _doesn&#039;t_ have to do with building or resolving dependencies? See the confusion? This is terrible exception handling practice IMO.


Those are my major problems with this code... the fact that the Builder is new&#039;d up also has me wondering (would it truly be necessary to new up a new Builder for every single operation?) but might not be a big issue.  The other ones bother me because they indicate some really poor design decisions IMO, which is even worse considering that this comes from a group called Patterns &amp; Practices.  Like it or not, many people in the Microsoft ecosystem will consider everything coming from P&amp;P as &#039;the way to go&#039; and this most certainly isn&#039;t that.</description>
		<content:encoded><![CDATA[<p>1) the code indicates that the Builder type has way too many responsibilities&#8230; why should you use a &#8216;Builder&#8217; to &#8216;tear down&#8217; an object? I assume the Builder class contains most of the code to resolve associations between dependencies, which is indeed needed for tearing down an object graph.  Constructing an object graph and tearing it down are two entirely different matters, especially in the context of an IOC container and it really shouldn&#8217;t be contained in one central piece. It just indicates that the Builder class is responsible for waaaay too many things</p>
<p>2) If the teardown method of the Builder fails, it throws a BuildFailedException, which indicates that the Builder in general only throws BuildFailedExceptions instead of exceptions that are relevant for what actually happened. Don&#8217;t you think it would be confusing if you were to get a BuildFailedException when you are _tearing down_ an object?</p>
<p>3) The UnityContainer automatically wraps that BuildFailedException into a ResolutionFailedException. What if the Teardown method failed for different reasons? Suppose that my object and its dependencies couldn&#8217;t be cleaned up properly for whatever reason that _doesn&#8217;t_ have to do with building or resolving dependencies? See the confusion? This is terrible exception handling practice IMO.</p>
<p>Those are my major problems with this code&#8230; the fact that the Builder is new&#8217;d up also has me wondering (would it truly be necessary to new up a new Builder for every single operation?) but might not be a big issue.  The other ones bother me because they indicate some really poor design decisions IMO, which is even worse considering that this comes from a group called Patterns &#038; Practices.  Like it or not, many people in the Microsoft ecosystem will consider everything coming from P&#038;P as &#8216;the way to go&#8217; and this most certainly isn&#8217;t that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrey R.</title>
		<link>http://davybrion.com/blog/2009/11/whats-wrong-with-this-picture-2/comment-page-1/#comment-23026</link>
		<dc:creator>Andrey R.</dc:creator>
		<pubDate>Mon, 23 Nov 2009 08:08:23 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1937#comment-23026</guid>
		<description>I was waiting for somebody smart to explain every bad piece of this code, but looks like nobody is going to. So, let me guess

1) The method could be generic. Well, I&#039;m sure PnP guys had some reason for making it non-generic;
2) Rethrowing ResolutionFailedException. Though why not?


And why using something called Builder internally indicates SRP violation?</description>
		<content:encoded><![CDATA[<p>I was waiting for somebody smart to explain every bad piece of this code, but looks like nobody is going to. So, let me guess</p>
<p>1) The method could be generic. Well, I&#8217;m sure PnP guys had some reason for making it non-generic;<br />
2) Rethrowing ResolutionFailedException. Though why not?</p>
<p>And why using something called Builder internally indicates SRP violation?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2009/11/whats-wrong-with-this-picture-2/comment-page-1/#comment-23023</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Sun, 22 Nov 2009 21:55:13 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1937#comment-23023</guid>
		<description>@Andrey

whether the base implementation does nothing and merely delegates to extensions (which i&#039;d hardly consider &#039;doing nothing&#039;) is pretty much irrelevant here... if you&#039;re using extensions, it most certainly does something

the issue is that that piece of code definitely shows a lot... even if you do consider it to be nothing</description>
		<content:encoded><![CDATA[<p>@Andrey</p>
<p>whether the base implementation does nothing and merely delegates to extensions (which i&#8217;d hardly consider &#8216;doing nothing&#8217;) is pretty much irrelevant here&#8230; if you&#8217;re using extensions, it most certainly does something</p>
<p>the issue is that that piece of code definitely shows a lot&#8230; even if you do consider it to be nothing</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrey R.</title>
		<link>http://davybrion.com/blog/2009/11/whats-wrong-with-this-picture-2/comment-page-1/#comment-23022</link>
		<dc:creator>Andrey R.</dc:creator>
		<pubDate>Sun, 22 Nov 2009 21:50:28 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1937#comment-23022</guid>
		<description>According to MSDN this code does nothing:

&lt;q cite=&quot;MSDN&quot;&gt;The UnityContainer class also exposes the Teardown method, which notionally would reverse the build-up process. However, the base implementation of this method does nothing. The implementation exists so that container extensions can execute their own custom overrides of this method if required.&lt;/q&gt;

So, what&#039;s the real problem here?</description>
		<content:encoded><![CDATA[<p>According to MSDN this code does nothing:</p>
<p><q cite="MSDN">The UnityContainer class also exposes the Teardown method, which notionally would reverse the build-up process. However, the base implementation of this method does nothing. The implementation exists so that container extensions can execute their own custom overrides of this method if required.</q></p>
<p>So, what&#8217;s the real problem here?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2009/11/whats-wrong-with-this-picture-2/comment-page-1/#comment-23021</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Sun, 22 Nov 2009 21:48:13 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1937#comment-23021</guid>
		<description>i wouldn&#039;t have a problem with that per se, if the class wasn&#039;t called Builder (which indicates a huge SRP violation)

but that&#039;s just one of the design issues that i have with that piece of code...</description>
		<content:encoded><![CDATA[<p>i wouldn&#8217;t have a problem with that per se, if the class wasn&#8217;t called Builder (which indicates a huge SRP violation)</p>
<p>but that&#8217;s just one of the design issues that i have with that piece of code&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will Wallace</title>
		<link>http://davybrion.com/blog/2009/11/whats-wrong-with-this-picture-2/comment-page-1/#comment-23020</link>
		<dc:creator>Will Wallace</dc:creator>
		<pubDate>Sun, 22 Nov 2009 19:07:08 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1937#comment-23020</guid>
		<description>I would say creating an object to tear down another is counterproductive...</description>
		<content:encoded><![CDATA[<p>I would say creating an object to tear down another is counterproductive&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2009/11/whats-wrong-with-this-picture-2/comment-page-1/#comment-23019</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Sun, 22 Nov 2009 19:03:11 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1937#comment-23019</guid>
		<description>@Tim

that&#039;s &#039;merely&#039; a coding error

it&#039;s the design problems that i find troubling</description>
		<content:encoded><![CDATA[<p>@Tim</p>
<p>that&#8217;s &#8216;merely&#8217; a coding error</p>
<p>it&#8217;s the design problems that i find troubling</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Van Wassenhove</title>
		<link>http://davybrion.com/blog/2009/11/whats-wrong-with-this-picture-2/comment-page-1/#comment-23018</link>
		<dc:creator>Tim Van Wassenhove</dc:creator>
		<pubDate>Sun, 22 Nov 2009 18:58:09 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1937#comment-23018</guid>
		<description>The catch block will throw a NullPointerException if o is null. 

(One could wonder why the &#039;new&#039; up a builder, but that&#039;s for another day.)</description>
		<content:encoded><![CDATA[<p>The catch block will throw a NullPointerException if o is null. </p>
<p>(One could wonder why the &#8216;new&#8217; up a builder, but that&#8217;s for another day.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Doolittle</title>
		<link>http://davybrion.com/blog/2009/11/whats-wrong-with-this-picture-2/comment-page-1/#comment-23017</link>
		<dc:creator>Jeff Doolittle</dc:creator>
		<pubDate>Sun, 22 Nov 2009 18:53:47 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1937#comment-23017</guid>
		<description>Just one more reason I’ll be sticking with StructureMap, thank you very much.</description>
		<content:encoded><![CDATA[<p>Just one more reason I’ll be sticking with StructureMap, thank you very much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Davy Brion</title>
		<link>http://davybrion.com/blog/2009/11/whats-wrong-with-this-picture-2/comment-page-1/#comment-23014</link>
		<dc:creator>Davy Brion</dc:creator>
		<pubDate>Sun, 22 Nov 2009 18:01:59 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1937#comment-23014</guid>
		<description>Yup

which is truly a shame, because that means that this code was written by Microsoft&#039;s PATTERNS AND PRACTICES group</description>
		<content:encoded><![CDATA[<p>Yup</p>
<p>which is truly a shame, because that means that this code was written by Microsoft&#8217;s PATTERNS AND PRACTICES group</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hwiechers</title>
		<link>http://davybrion.com/blog/2009/11/whats-wrong-with-this-picture-2/comment-page-1/#comment-23013</link>
		<dc:creator>hwiechers</dc:creator>
		<pubDate>Sun, 22 Nov 2009 17:54:51 +0000</pubDate>
		<guid isPermaLink="false">http://davybrion.com/blog/?p=1937#comment-23013</guid>
		<description>Is it from Unity?</description>
		<content:encoded><![CDATA[<p>Is it from Unity?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
