<?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: Constructor Injection vs Setter Injection</title>
	<atom:link href="http://shaun.boyblack.co.za/blog/2009/05/01/constructor-injection-vs-setter-injection/feed/" rel="self" type="application/rss+xml" />
	<link>http://shaun.boyblack.co.za/blog/2009/05/01/constructor-injection-vs-setter-injection/</link>
	<description>Flex, Ruby, Mongo - London, UK</description>
	<lastBuildDate>Mon, 06 Feb 2012 19:52:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Dependency Injection with constructors? &#171; FINN.no tech blog</title>
		<link>http://shaun.boyblack.co.za/blog/2009/05/01/constructor-injection-vs-setter-injection/comment-page-1/#comment-8992</link>
		<dc:creator>Dependency Injection with constructors? &#171; FINN.no tech blog</dc:creator>
		<pubDate>Fri, 13 May 2011 15:24:56 +0000</pubDate>
		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/?p=512#comment-8992</guid>
		<description>[...] Another read that investigates IoC : Constructor Injection vs Setter Injection &#8211; Shaun Smith [...]</description>
		<content:encoded><![CDATA[<p>[...] Another read that investigates IoC : Constructor Injection vs Setter Injection &#8211; Shaun Smith [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Semb Wever</title>
		<link>http://shaun.boyblack.co.za/blog/2009/05/01/constructor-injection-vs-setter-injection/comment-page-1/#comment-8991</link>
		<dc:creator>Michael Semb Wever</dc:creator>
		<pubDate>Fri, 13 May 2011 15:20:00 +0000</pubDate>
		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/?p=512#comment-8991</guid>
		<description>Great read!

Just wrote an article that questions the preference towards constructor injection by investigating IoC (like you have also done here), API Design, and other factors in the big picture of coding the application.
 http://tech.finn.no/2011/05/13/dependency-injection-with-constructors/ </description>
		<content:encoded><![CDATA[<p>Great read!</p>
<p>Just wrote an article that questions the preference towards constructor injection by investigating IoC (like you have also done here), API Design, and other factors in the big picture of coding the application.<br />
 http://tech.finn.no/2011/05/13/dependency-injection-with-constructors/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: srikanth</title>
		<link>http://shaun.boyblack.co.za/blog/2009/05/01/constructor-injection-vs-setter-injection/comment-page-1/#comment-4315</link>
		<dc:creator>srikanth</dc:creator>
		<pubDate>Wed, 27 May 2009 12:19:46 +0000</pubDate>
		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/?p=512#comment-4315</guid>
		<description>what ever you stated is true but requested to have a look on Context IOC, And i hope its all up to the developer which on to choose, if we keep OOP&#039;s in mind</description>
		<content:encoded><![CDATA[<p>what ever you stated is true but requested to have a look on Context IOC, And i hope its all up to the developer which on to choose, if we keep OOP&#8217;s in mind</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: srikanth</title>
		<link>http://shaun.boyblack.co.za/blog/2009/05/01/constructor-injection-vs-setter-injection/comment-page-1/#comment-8916</link>
		<dc:creator>srikanth</dc:creator>
		<pubDate>Wed, 27 May 2009 12:19:00 +0000</pubDate>
		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/?p=512#comment-8916</guid>
		<description>what ever you stated is true but requested to have a look on Context IOC, And i hope its all up to the developer which on to choose, if we keep OOP&#039;s in mind</description>
		<content:encoded><![CDATA[<p>what ever you stated is true but requested to have a look on Context IOC, And i hope its all up to the developer which on to choose, if we keep OOP&#8217;s in mind</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shaun</title>
		<link>http://shaun.boyblack.co.za/blog/2009/05/01/constructor-injection-vs-setter-injection/comment-page-1/#comment-3857</link>
		<dc:creator>shaun</dc:creator>
		<pubDate>Tue, 12 May 2009 10:41:53 +0000</pubDate>
		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/?p=512#comment-3857</guid>
		<description>Hi Richard,

I fully agree! I should point out that most of my thinking has been in the realm of architectural/application framework design (see: &lt;a href=&quot;http://shaun.boyblack.co.za/blog/2009/04/16/robotlegs-an-as3-mvcs-framework-for-flash-and-flex-applications-inspired-by-puremvc/&quot; rel=&quot;nofollow&quot;&gt;RobotLegs&lt;/a&gt;).

I&#039;m hoping that SmartyPants-IOC introduces constructor injection soon (it has been rumoured). Well, actually I&#039;m hoping that someone releases a DI framework with no Flex dependencies that supports both constructor and annotated setter injection :)

For my framework actors (modelled on PureMVC) I&#039;m happy with annotated setter injection - as the actors are mostly just hookup/decoupling/bridge points and tend to change quite a bit as an application grows. Once an application&#039;s architectural design has settled down, however, I would like to be able to refactor to constructor injection.</description>
		<content:encoded><![CDATA[<p>Hi Richard,</p>
<p>I fully agree! I should point out that most of my thinking has been in the realm of architectural/application framework design (see: <a href="http://shaun.boyblack.co.za/blog/2009/04/16/robotlegs-an-as3-mvcs-framework-for-flash-and-flex-applications-inspired-by-puremvc/" rel="nofollow">RobotLegs</a>).</p>
<p>I&#8217;m hoping that SmartyPants-IOC introduces constructor injection soon (it has been rumoured). Well, actually I&#8217;m hoping that someone releases a DI framework with no Flex dependencies that supports both constructor and annotated setter injection <img src='http://shaun.boyblack.co.za/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>For my framework actors (modelled on PureMVC) I&#8217;m happy with annotated setter injection &#8211; as the actors are mostly just hookup/decoupling/bridge points and tend to change quite a bit as an application grows. Once an application&#8217;s architectural design has settled down, however, I would like to be able to refactor to constructor injection.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shaun</title>
		<link>http://shaun.boyblack.co.za/blog/2009/05/01/constructor-injection-vs-setter-injection/comment-page-1/#comment-8915</link>
		<dc:creator>shaun</dc:creator>
		<pubDate>Tue, 12 May 2009 10:41:00 +0000</pubDate>
		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/?p=512#comment-8915</guid>
		<description>Hi Richard,

I fully agree! I should point out that most of my thinking has been in the realm of architectural/application framework design (see: &lt;a href=&quot;http://shaun.boyblack.co.za/blog/2009/04/16/robotlegs-an-as3-mvcs-framework-for-flash-and-flex-applications-inspired-by-puremvc/&quot; rel=&quot;nofollow&quot;&gt;RobotLegs&lt;/a&gt;).

I&#039;m hoping that SmartyPants-IOC introduces constructor injection soon (it has been rumoured). Well, actually I&#039;m hoping that someone releases a DI framework with no Flex dependencies that supports both constructor and annotated setter injection :)

For my framework actors (modelled on PureMVC) I&#039;m happy with annotated setter injection - as the actors are mostly just hookup/decoupling/bridge points and tend to change quite a bit as an application grows. Once an application&#039;s architectural design has settled down, however, I would like to be able to refactor to constructor injection.</description>
		<content:encoded><![CDATA[<p>Hi Richard,</p>
<p>I fully agree! I should point out that most of my thinking has been in the realm of architectural/application framework design (see: <a href="http://shaun.boyblack.co.za/blog/2009/04/16/robotlegs-an-as3-mvcs-framework-for-flash-and-flex-applications-inspired-by-puremvc/" rel="nofollow">RobotLegs</a>).</p>
<p>I&#8217;m hoping that SmartyPants-IOC introduces constructor injection soon (it has been rumoured). Well, actually I&#8217;m hoping that someone releases a DI framework with no Flex dependencies that supports both constructor and annotated setter injection <img src='http://shaun.boyblack.co.za/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>For my framework actors (modelled on PureMVC) I&#8217;m happy with annotated setter injection &#8211; as the actors are mostly just hookup/decoupling/bridge points and tend to change quite a bit as an application grows. Once an application&#8217;s architectural design has settled down, however, I would like to be able to refactor to constructor injection.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard Lord</title>
		<link>http://shaun.boyblack.co.za/blog/2009/05/01/constructor-injection-vs-setter-injection/comment-page-1/#comment-3855</link>
		<dc:creator>Richard Lord</dc:creator>
		<pubDate>Tue, 12 May 2009 10:17:16 +0000</pubDate>
		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/?p=512#comment-3855</guid>
		<description>Hi Shaun

One area where constructor injection becomes very useful is with existing code. If classes require their dependencies in the constructor there is no need for language constructs like smarty-pants&#039; [Inject] meta-data in order to enable the injection. This makes it easier to use existing code libraries with a DI container if the container uses constructor injection.

On the other hand, due to the method of their construction, it&#039;s difficult to use constructor injection with Flex components.

Because MXML pushes us towards constructors with no parameters, I&#039;m inclined towards setter injection for Flex projects. But it does frustrate when one wants to use DI with an existing open source library like Away3D or my own Flint.</description>
		<content:encoded><![CDATA[<p>Hi Shaun</p>
<p>One area where constructor injection becomes very useful is with existing code. If classes require their dependencies in the constructor there is no need for language constructs like smarty-pants&#8217; [Inject] meta-data in order to enable the injection. This makes it easier to use existing code libraries with a DI container if the container uses constructor injection.</p>
<p>On the other hand, due to the method of their construction, it&#8217;s difficult to use constructor injection with Flex components.</p>
<p>Because MXML pushes us towards constructors with no parameters, I&#8217;m inclined towards setter injection for Flex projects. But it does frustrate when one wants to use DI with an existing open source library like Away3D or my own Flint.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard Lord</title>
		<link>http://shaun.boyblack.co.za/blog/2009/05/01/constructor-injection-vs-setter-injection/comment-page-1/#comment-8914</link>
		<dc:creator>Richard Lord</dc:creator>
		<pubDate>Tue, 12 May 2009 10:17:00 +0000</pubDate>
		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/?p=512#comment-8914</guid>
		<description>Hi Shaun

One area where constructor injection becomes very useful is with existing code. If classes require their dependencies in the constructor there is no need for language constructs like smarty-pants&#039; [Inject] meta-data in order to enable the injection. This makes it easier to use existing code libraries with a DI container if the container uses constructor injection.

On the other hand, due to the method of their construction, it&#039;s difficult to use constructor injection with Flex components.

Because MXML pushes us towards constructors with no parameters, I&#039;m inclined towards setter injection for Flex projects. But it does frustrate when one wants to use DI with an existing open source library like Away3D or my own Flint.</description>
		<content:encoded><![CDATA[<p>Hi Shaun</p>
<p>One area where constructor injection becomes very useful is with existing code. If classes require their dependencies in the constructor there is no need for language constructs like smarty-pants&#8217; [Inject] meta-data in order to enable the injection. This makes it easier to use existing code libraries with a DI container if the container uses constructor injection.</p>
<p>On the other hand, due to the method of their construction, it&#8217;s difficult to use constructor injection with Flex components.</p>
<p>Because MXML pushes us towards constructors with no parameters, I&#8217;m inclined towards setter injection for Flex projects. But it does frustrate when one wants to use DI with an existing open source library like Away3D or my own Flint.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shaun</title>
		<link>http://shaun.boyblack.co.za/blog/2009/05/01/constructor-injection-vs-setter-injection/comment-page-1/#comment-3642</link>
		<dc:creator>shaun</dc:creator>
		<pubDate>Wed, 06 May 2009 01:53:38 +0000</pubDate>
		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/?p=512#comment-3642</guid>
		<description>Thanks Darren. Doh, I totally forgot about the &quot;ordering&quot; issue - probably because I haven&#039;t come across it in my own code (yet), but also perhaps because I have a feeling it may be invalid..

Should the order in which we are given our dependencies ever be important?

I don&#039;t think so. What&#039;s important is that our dependencies be entirely satisfied at some point, and that we know when that point is: so that we can consider ourselves &quot;fully&quot; constructed or &quot;ready&quot; and get on with things.

The order of instantiation of the dependencies themselves might be important, but that is not our concern - that is the concern of the container. That&#039;s context stuff, and shouldn&#039;t matter to us inside our class where we have a specific job to do.. when we&#039;re &quot;ready&quot;.

And how do we know when we&#039;re ready? Well, that&#039;s the murky part.. &quot;When we&#039;re told so&quot;.

I might well be overlooking something, but I hope not.

As for the SmartPants-IOC setter vibes.. yes,.. &quot;properties which should really be private are made public to satisfy the injection framework&quot;. Yeh, I know what you&#039;re thinking!.. But is that really so bad when one views dependencies as immutable properties? - set during the construction phase, and never altered thereafter.

Manipulating objects (changing their state) from the outside isn&#039;t such a good idea most of the time anyway - it puts knowledge in the wrong place and is often responsible for tight coupling. Properties don&#039;t make for good API&#039;s. Here, properties are bad.

On the other side of the fence live Value Objects. No logic, no methods, no access control, just complex, nested, value types.. value structures. Public properties. Here, properties are good.

To help me sleep better, I just lump dependencies in the same conceptual bucket as Value Objects.. and hope that the nagging feeling fades over time!</description>
		<content:encoded><![CDATA[<p>Thanks Darren. Doh, I totally forgot about the &#8220;ordering&#8221; issue &#8211; probably because I haven&#8217;t come across it in my own code (yet), but also perhaps because I have a feeling it may be invalid..</p>
<p>Should the order in which we are given our dependencies ever be important?</p>
<p>I don&#8217;t think so. What&#8217;s important is that our dependencies be entirely satisfied at some point, and that we know when that point is: so that we can consider ourselves &#8220;fully&#8221; constructed or &#8220;ready&#8221; and get on with things.</p>
<p>The order of instantiation of the dependencies themselves might be important, but that is not our concern &#8211; that is the concern of the container. That&#8217;s context stuff, and shouldn&#8217;t matter to us inside our class where we have a specific job to do.. when we&#8217;re &#8220;ready&#8221;.</p>
<p>And how do we know when we&#8217;re ready? Well, that&#8217;s the murky part.. &#8220;When we&#8217;re told so&#8221;.</p>
<p>I might well be overlooking something, but I hope not.</p>
<p>As for the SmartPants-IOC setter vibes.. yes,.. &#8220;properties which should really be private are made public to satisfy the injection framework&#8221;. Yeh, I know what you&#8217;re thinking!.. But is that really so bad when one views dependencies as immutable properties? &#8211; set during the construction phase, and never altered thereafter.</p>
<p>Manipulating objects (changing their state) from the outside isn&#8217;t such a good idea most of the time anyway &#8211; it puts knowledge in the wrong place and is often responsible for tight coupling. Properties don&#8217;t make for good API&#8217;s. Here, properties are bad.</p>
<p>On the other side of the fence live Value Objects. No logic, no methods, no access control, just complex, nested, value types.. value structures. Public properties. Here, properties are good.</p>
<p>To help me sleep better, I just lump dependencies in the same conceptual bucket as Value Objects.. and hope that the nagging feeling fades over time!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shaun</title>
		<link>http://shaun.boyblack.co.za/blog/2009/05/01/constructor-injection-vs-setter-injection/comment-page-1/#comment-8913</link>
		<dc:creator>shaun</dc:creator>
		<pubDate>Wed, 06 May 2009 01:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://shaun.boyblack.co.za/blog/?p=512#comment-8913</guid>
		<description>Thanks Darren. Doh, I totally forgot about the &quot;ordering&quot; issue - probably because I haven&#039;t come across it in my own code (yet), but also perhaps because I have a feeling it may be invalid..

Should the order in which we are given our dependencies ever be important?

I don&#039;t think so. What&#039;s important is that our dependencies be entirely satisfied at some point, and that we know when that point is: so that we can consider ourselves &quot;fully&quot; constructed or &quot;ready&quot; and get on with things.

The order of instantiation of the dependencies themselves might be important, but that is not our concern - that is the concern of the container. That&#039;s context stuff, and shouldn&#039;t matter to us inside our class where we have a specific job to do.. when we&#039;re &quot;ready&quot;.

And how do we know when we&#039;re ready? Well, that&#039;s the murky part.. &quot;When we&#039;re told so&quot;.

I might well be overlooking something, but I hope not.

As for the SmartPants-IOC setter vibes.. yes,.. &quot;properties which should really be private are made public to satisfy the injection framework&quot;. Yeh, I know what you&#039;re thinking!.. But is that really so bad when one views dependencies as immutable properties? - set during the construction phase, and never altered thereafter.

Manipulating objects (changing their state) from the outside isn&#039;t such a good idea most of the time anyway - it puts knowledge in the wrong place and is often responsible for tight coupling. Properties don&#039;t make for good API&#039;s. Here, properties are bad.

On the other side of the fence live Value Objects. No logic, no methods, no access control, just complex, nested, value types.. value structures. Public properties. Here, properties are good.

To help me sleep better, I just lump dependencies in the same conceptual bucket as Value Objects.. and hope that the nagging feeling fades over time!</description>
		<content:encoded><![CDATA[<p>Thanks Darren. Doh, I totally forgot about the &#8220;ordering&#8221; issue &#8211; probably because I haven&#8217;t come across it in my own code (yet), but also perhaps because I have a feeling it may be invalid..</p>
<p>Should the order in which we are given our dependencies ever be important?</p>
<p>I don&#8217;t think so. What&#8217;s important is that our dependencies be entirely satisfied at some point, and that we know when that point is: so that we can consider ourselves &#8220;fully&#8221; constructed or &#8220;ready&#8221; and get on with things.</p>
<p>The order of instantiation of the dependencies themselves might be important, but that is not our concern &#8211; that is the concern of the container. That&#8217;s context stuff, and shouldn&#8217;t matter to us inside our class where we have a specific job to do.. when we&#8217;re &#8220;ready&#8221;.</p>
<p>And how do we know when we&#8217;re ready? Well, that&#8217;s the murky part.. &#8220;When we&#8217;re told so&#8221;.</p>
<p>I might well be overlooking something, but I hope not.</p>
<p>As for the SmartPants-IOC setter vibes.. yes,.. &#8220;properties which should really be private are made public to satisfy the injection framework&#8221;. Yeh, I know what you&#8217;re thinking!.. But is that really so bad when one views dependencies as immutable properties? &#8211; set during the construction phase, and never altered thereafter.</p>
<p>Manipulating objects (changing their state) from the outside isn&#8217;t such a good idea most of the time anyway &#8211; it puts knowledge in the wrong place and is often responsible for tight coupling. Properties don&#8217;t make for good API&#8217;s. Here, properties are bad.</p>
<p>On the other side of the fence live Value Objects. No logic, no methods, no access control, just complex, nested, value types.. value structures. Public properties. Here, properties are good.</p>
<p>To help me sleep better, I just lump dependencies in the same conceptual bucket as Value Objects.. and hope that the nagging feeling fades over time!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

