<?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: Too Much of a Good Thing? Constructor Injection Overload</title>
	<atom:link href="http://christopherdeweese.com/blog2/post/too-much-of-a-good-thing-constructor-injection-overload/feed" rel="self" type="application/rss+xml" />
	<link>http://christopherdeweese.com/blog2/post/too-much-of-a-good-thing-constructor-injection-overload</link>
	<description>IArchitect, IBlog, ILeader</description>
	<lastBuildDate>Fri, 02 Jul 2010 14:23:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Chris</title>
		<link>http://christopherdeweese.com/blog2/post/too-much-of-a-good-thing-constructor-injection-overload/comment-page-1#comment-115</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Thu, 21 Jan 2010 15:46:40 +0000</pubDate>
		<guid isPermaLink="false">http://christopherdeweese.com/blog2/post/too-much-of-a-good-thing-constructor-injection-overload#comment-115</guid>
		<description>Surely they can and that is something I should dig into because I&#039;m pretty big on letting containers do the work.  I guess the counter to that is you probably shouldn&#039;t rely on that behavior 100% of the time because what if it changes.

One thing that Uncle Bob pointed out in his article, is to keep those details out of your app.  It is pretty rare that I make container calls directly from my classes and if I do it is through some type of factory abstraction.

The testing inconvenience can be painful, but using something like Moq you can setup just the pieces you need for the test to run.  

Good comments, now I&#039;m thinking I should update the post.</description>
		<content:encoded><![CDATA[<p>Surely they can and that is something I should dig into because I&#8217;m pretty big on letting containers do the work.  I guess the counter to that is you probably shouldn&#8217;t rely on that behavior 100% of the time because what if it changes.</p>
<p>One thing that Uncle Bob pointed out in his article, is to keep those details out of your app.  It is pretty rare that I make container calls directly from my classes and if I do it is through some type of factory abstraction.</p>
<p>The testing inconvenience can be painful, but using something like Moq you can setup just the pieces you need for the test to run.  </p>
<p>Good comments, now I&#8217;m thinking I should update the post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://christopherdeweese.com/blog2/post/too-much-of-a-good-thing-constructor-injection-overload/comment-page-1#comment-114</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Thu, 21 Jan 2010 15:34:39 +0000</pubDate>
		<guid isPermaLink="false">http://christopherdeweese.com/blog2/post/too-much-of-a-good-thing-constructor-injection-overload#comment-114</guid>
		<description>Shouldn&#039;t your IoC container be able to create a proxy for you to do lazy instantiation, even if it is a constructor injected dependency? 

It&#039;s an inconvenience, especially when testing, to pass so many dependencies in, but if you&#039;re worried about all that instantiation affecting performance, would you be better off dealing with it via the container?...maybe even via config of the container where you could tell it these dependencies of the class are always needed and these others are lazy.</description>
		<content:encoded><![CDATA[<p>Shouldn&#8217;t your IoC container be able to create a proxy for you to do lazy instantiation, even if it is a constructor injected dependency? </p>
<p>It&#8217;s an inconvenience, especially when testing, to pass so many dependencies in, but if you&#8217;re worried about all that instantiation affecting performance, would you be better off dealing with it via the container?&#8230;maybe even via config of the container where you could tell it these dependencies of the class are always needed and these others are lazy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://christopherdeweese.com/blog2/post/too-much-of-a-good-thing-constructor-injection-overload/comment-page-1#comment-112</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Thu, 21 Jan 2010 14:18:15 +0000</pubDate>
		<guid isPermaLink="false">http://christopherdeweese.com/blog2/post/too-much-of-a-good-thing-constructor-injection-overload#comment-112</guid>
		<description>You bring up another good point that has been on my mind too -- how many dependencies is too many?  Because some class has to be responsible for the overall composition: who calls who to do what.  IoC helps remove some of the worries about how you resolve and load those dependencies but it does not solve the problem of how you structure the app overall.  

Even if you refactor to smaller classes (which I totally am in favor of) someone still has to know to compose all those smaller classes to get work done.  So perhaps you use smaller classes with fewer constructor dependencies then you have a few &quot;dirty&quot; classes that know who to call?

From a guy who works with the VS team I thought you&#039;d have this all figured out?  :)</description>
		<content:encoded><![CDATA[<p>You bring up another good point that has been on my mind too &#8212; how many dependencies is too many?  Because some class has to be responsible for the overall composition: who calls who to do what.  IoC helps remove some of the worries about how you resolve and load those dependencies but it does not solve the problem of how you structure the app overall.  </p>
<p>Even if you refactor to smaller classes (which I totally am in favor of) someone still has to know to compose all those smaller classes to get work done.  So perhaps you use smaller classes with fewer constructor dependencies then you have a few &#8220;dirty&#8221; classes that know who to call?</p>
<p>From a guy who works with the VS team I thought you&#8217;d have this all figured out?  <img src='http://christopherdeweese.com/blog2/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Barile</title>
		<link>http://christopherdeweese.com/blog2/post/too-much-of-a-good-thing-constructor-injection-overload/comment-page-1#comment-111</link>
		<dc:creator>Jason Barile</dc:creator>
		<pubDate>Thu, 21 Jan 2010 14:13:35 +0000</pubDate>
		<guid isPermaLink="false">http://christopherdeweese.com/blog2/post/too-much-of-a-good-thing-constructor-injection-overload#comment-111</guid>
		<description>Perhaps it&#039;s just my limted personal experience with IoC, but I&#039;m not convinced (yet) that making my classes more complex by adding calls to factories that abstract away calls to service locators (or worse, making my classes depend directly on the IoC containers themselves) is all that much better than a few extra parameters being passed into a constructor.  Perhaps another valid approach would be to consider why the class has so many different contexts that not all of the dependencies are used in every case and refactor it down to multiple classes.  In the end, I&#039;m sure there are cases where both approached make sense - thanks for pointing out the design consideration!</description>
		<content:encoded><![CDATA[<p>Perhaps it&#8217;s just my limted personal experience with IoC, but I&#8217;m not convinced (yet) that making my classes more complex by adding calls to factories that abstract away calls to service locators (or worse, making my classes depend directly on the IoC containers themselves) is all that much better than a few extra parameters being passed into a constructor.  Perhaps another valid approach would be to consider why the class has so many different contexts that not all of the dependencies are used in every case and refactor it down to multiple classes.  In the end, I&#8217;m sure there are cases where both approached make sense &#8211; thanks for pointing out the design consideration!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

