<?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: When to use Dependency Injection</title>
	<atom:link href="http://misko.hevery.com/2009/01/14/when-to-use-dependency-injection/feed/" rel="self" type="application/rss+xml" />
	<link>http://misko.hevery.com/2009/01/14/when-to-use-dependency-injection/</link>
	<description>Testability Explorer</description>
	<lastBuildDate>Fri, 30 Jul 2010 03:59:03 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Multi Tenant Architecture via Dependency Injection: Part 1</title>
		<link>http://misko.hevery.com/2009/01/14/when-to-use-dependency-injection/comment-page-1/#comment-3726</link>
		<dc:creator>Multi Tenant Architecture via Dependency Injection: Part 1</dc:creator>
		<pubDate>Sun, 11 Jul 2010 20:51:41 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=380#comment-3726</guid>
		<description>[...] using a dependency injection framework, which is not the scope of this essay but can be enumerated here, for instance. Our example will use Ninject and ASP.NET MVC, although you could use any DI and [...]</description>
		<content:encoded><![CDATA[<p>[...] using a dependency injection framework, which is not the scope of this essay but can be enumerated here, for instance. Our example will use Ninject and ASP.NET MVC, although you could use any DI and [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Test Driven Development</title>
		<link>http://misko.hevery.com/2009/01/14/when-to-use-dependency-injection/comment-page-1/#comment-2351</link>
		<dc:creator>Test Driven Development</dc:creator>
		<pubDate>Tue, 17 Nov 2009 01:26:23 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=380#comment-2351</guid>
		<description>[...] links to his site and there I found excellent articles that changed the way I approach programming. When to use Dependency Injection, Guide to Writing Testable Code and Dependency Injection Myth: Reference Passing are some of the [...]</description>
		<content:encoded><![CDATA[<p>[...] links to his site and there I found excellent articles that changed the way I approach programming. When to use Dependency Injection, Guide to Writing Testable Code and Dependency Injection Myth: Reference Passing are some of the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Soapbox Rants and Raves &#187; Good Reading&#8230;</title>
		<link>http://misko.hevery.com/2009/01/14/when-to-use-dependency-injection/comment-page-1/#comment-939</link>
		<dc:creator>Soapbox Rants and Raves &#187; Good Reading&#8230;</dc:creator>
		<pubDate>Sat, 02 May 2009 14:34:00 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=380#comment-939</guid>
		<description>[...] having to put them into words! Please check out his posts, topics range from testability, to dependency injection, to Changing Developer [...]</description>
		<content:encoded><![CDATA[<p>[...] having to put them into words! Please check out his posts, topics range from testability, to dependency injection, to Changing Developer [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 1up4Developers &#187; Blog Archive &#187; TPW - Testando sistemas legados: manipulando dependências</title>
		<link>http://misko.hevery.com/2009/01/14/when-to-use-dependency-injection/comment-page-1/#comment-699</link>
		<dc:creator>1up4Developers &#187; Blog Archive &#187; TPW - Testando sistemas legados: manipulando dependências</dc:creator>
		<pubDate>Thu, 19 Feb 2009 15:48:51 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=380#comment-699</guid>
		<description>[...] da classe são delegados à outro objeto, ou normalmente um container de objetos, responsável por injetar as dependências nas instâncias das classes. Simples, não?! Mas isso será detalhado em outro [...]</description>
		<content:encoded><![CDATA[<p>[...] da classe são delegados à outro objeto, ou normalmente um container de objetos, responsável por injetar as dependências nas instâncias das classes. Simples, não?! Mas isso será detalhado em outro [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oh, your comments...</title>
		<link>http://misko.hevery.com/2009/01/14/when-to-use-dependency-injection/comment-page-1/#comment-621</link>
		<dc:creator>Oh, your comments...</dc:creator>
		<pubDate>Sun, 25 Jan 2009 23:37:09 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=380#comment-621</guid>
		<description>You will argue about which DI framework is better but what about THE subject: to use or not to use framework?I will agree that DI is the way to go, but I am sure this applies to the smallest applications as well. Nothing keeps the right order of things in application better than DI.But manual DI produces so much boilerplate code, that the clear benefits of using it starts to vanish. Few weeks ago I decided to do a first step in making my application better, because it looks like a spaghetti in many places. This is a large Swing application client for EJB3 back-end. I was asking myself exactly the same question: to choose a framework or not. I decided not to pick up framework and do manual DI. After few days I had a feeling that something goes wrong. Then I created a little, tiny Swing application&#160; from scratch using (for the first time) Guice (excluding EJB3 - that was my first DI framework I dealt with in practice). When I finished it and moved back to my main job, the Swing client without DI framework, I felt like I there was missing something fundamental. One of the most brilliant features is the automatic creation of factories in Guice (called Providers, I am sure Spring has something simmilar). In Swing this is very common to ask for something new on every method call. Automatic creation of providers is so great. Without it, I would have to write like dozens, hundreds of dump factories and keep track of every single dependency, bacause factories need factories, those other factories propably need another factories. Terrible to keep the track manually.Another aspect is that without good framework there is always a tempation to create something using &quot;new&quot; in the bussiness code. You think - this class is a leaf, why shold I bother creating yet another factory for that. But when that leaf becomes a non-leaf, you end up with dozen places where you have to get rid of &quot;new&quot; and use your brand new, yet another factory... In Guice I am injecting everything, even if that is a leaf, because that costs me so little, just:@Injectprivate Provider&lt;Something&gt; somethingProvider;and later:Something = something.get();As soon as that &quot;Something&quot; becomes a non-leaf, everything still works. In my &quot;Something&quot; I can use injection and I do not care about proper wiring the stuff together. That was my $0.02 :)Regards,Witold SzczerbaP.S.Why everyone says: Spring does not need XML config, because since v2.5 it works with annotations.Maybe I;m wrong, but annotations are way too little to configure a module. In Guice, the counterpart Spring&#039;s XML files are the com.google.inject.Module classes (by implementing the interface directly or by extending AbstractModule). I find it impossible to configure DI framework using the annotations and nothing more.</description>
		<content:encoded><![CDATA[<p>You will argue about which DI framework is better but what about THE subject: to use or not to use framework?I will agree that DI is the way to go, but I am sure this applies to the smallest applications as well. Nothing keeps the right order of things in application better than DI.But manual DI produces so much boilerplate code, that the clear benefits of using it starts to vanish. Few weeks ago I decided to do a first step in making my application better, because it looks like a spaghetti in many places. This is a large Swing application client for EJB3 back-end. I was asking myself exactly the same question: to choose a framework or not. I decided not to pick up framework and do manual DI. After few days I had a feeling that something goes wrong. Then I created a little, tiny Swing application&nbsp; from scratch using (for the first time) Guice (excluding EJB3 &#8211; that was my first DI framework I dealt with in practice). When I finished it and moved back to my main job, the Swing client without DI framework, I felt like I there was missing something fundamental. One of the most brilliant features is the automatic creation of factories in Guice (called Providers, I am sure Spring has something simmilar). In Swing this is very common to ask for something new on every method call. Automatic creation of providers is so great. Without it, I would have to write like dozens, hundreds of dump factories and keep track of every single dependency, bacause factories need factories, those other factories propably need another factories. Terrible to keep the track manually.Another aspect is that without good framework there is always a tempation to create something using &#8220;new&#8221; in the bussiness code. You think &#8211; this class is a leaf, why shold I bother creating yet another factory for that. But when that leaf becomes a non-leaf, you end up with dozen places where you have to get rid of &#8220;new&#8221; and use your brand new, yet another factory&#8230; In Guice I am injecting everything, even if that is a leaf, because that costs me so little, just:@Injectprivate Provider&lt;Something&gt; somethingProvider;and later:Something = something.get();As soon as that &#8220;Something&#8221; becomes a non-leaf, everything still works. In my &#8220;Something&#8221; I can use injection and I do not care about proper wiring the stuff together. That was my $0.02 <img src='http://misko.hevery.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> Regards,Witold SzczerbaP.S.Why everyone says: Spring does not need XML config, because since v2.5 it works with annotations.Maybe I;m wrong, but annotations are way too little to configure a module. In Guice, the counterpart Spring&#8217;s XML files are the com.google.inject.Module classes (by implementing the interface directly or by extending AbstractModule). I find it impossible to configure DI framework using the annotations and nothing more.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason</title>
		<link>http://misko.hevery.com/2009/01/14/when-to-use-dependency-injection/comment-page-1/#comment-606</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Thu, 22 Jan 2009 00:23:22 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=380#comment-606</guid>
		<description>Chris,I would like to know why you find Guice&#039;s DI much nicer to use than Spring&#039;s?&#160; I hope you are comparing apples-to-apples and are comparing the use of spring annotations vs. Guice annotations because I would like to know how the annotation implementations differ.</description>
		<content:encoded><![CDATA[<p>Chris,I would like to know why you find Guice&#8217;s DI much nicer to use than Spring&#8217;s?&nbsp; I hope you are comparing apples-to-apples and are comparing the use of spring annotations vs. Guice annotations because I would like to know how the annotation implementations differ.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason</title>
		<link>http://misko.hevery.com/2009/01/14/when-to-use-dependency-injection/comment-page-1/#comment-605</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Thu, 22 Jan 2009 00:20:33 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=380#comment-605</guid>
		<description>Misko,I would like see a post on why you favor constructor injection over setter injection.&#160; This is a common question that comes up when developers are first introduced to DI.</description>
		<content:encoded><![CDATA[<p>Misko,I would like see a post on why you favor constructor injection over setter injection.&nbsp; This is a common question that comes up when developers are first introduced to DI.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim</title>
		<link>http://misko.hevery.com/2009/01/14/when-to-use-dependency-injection/comment-page-1/#comment-586</link>
		<dc:creator>Tim</dc:creator>
		<pubDate>Thu, 15 Jan 2009 23:20:56 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=380#comment-586</guid>
		<description>Doesn&#039;t Pico predate Spring?&#160; I&#039;m pretty sure it does...</description>
		<content:encoded><![CDATA[<p>Doesn&#8217;t Pico predate Spring?&nbsp; I&#8217;m pretty sure it does&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://misko.hevery.com/2009/01/14/when-to-use-dependency-injection/comment-page-1/#comment-581</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Thu, 15 Jan 2009 08:24:00 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=380#comment-581</guid>
		<description>Spring 2.5&#039;s documentation states &quot;The Spring team generally advocates the usage of setter
        injection&quot;.&#160; I strongly favour constructor injection (for immutability) and dislike XML for configuration.&#160; I&#039;ve used both Spring and Guice extensively and I find Guice&#039;s DI much nicer to use than Spring&#039;s.</description>
		<content:encoded><![CDATA[<p>Spring 2.5&#8217;s documentation states &#8220;The Spring team generally advocates the usage of setter<br />
        injection&#8221;.&nbsp; I strongly favour constructor injection (for immutability) and dislike XML for configuration.&nbsp; I&#8217;ve used both Spring and Guice extensively and I find Guice&#8217;s DI much nicer to use than Spring&#8217;s.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sisuk</title>
		<link>http://misko.hevery.com/2009/01/14/when-to-use-dependency-injection/comment-page-1/#comment-580</link>
		<dc:creator>sisuk</dc:creator>
		<pubDate>Thu, 15 Jan 2009 01:46:37 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=380#comment-580</guid>
		<description>Agreed Andre.&#160; Spring also does constructor injection.&#160; I can understand some bias since Misko works for Google, but keep in mind Spring is still the 800 pound gorilla of DI frameworks.</description>
		<content:encoded><![CDATA[<p>Agreed Andre.&nbsp; Spring also does constructor injection.&nbsp; I can understand some bias since Misko works for Google, but keep in mind Spring is still the 800 pound gorilla of DI frameworks.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
