<?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: Dependency Injection Myth: Reference Passing</title>
	<atom:link href="http://misko.hevery.com/2008/10/21/dependency-injection-myth-reference-passing/feed/" rel="self" type="application/rss+xml" />
	<link>http://misko.hevery.com/2008/10/21/dependency-injection-myth-reference-passing/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dependency-injection-myth-reference-passing</link>
	<description>Testability Explorer</description>
	<lastBuildDate>Thu, 19 Jan 2012 16:42:57 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Are singletons pathalogical liars? &#124; Davelog</title>
		<link>http://misko.hevery.com/2008/10/21/dependency-injection-myth-reference-passing/comment-page-1/#comment-15750</link>
		<dc:creator>Are singletons pathalogical liars? &#124; Davelog</dc:creator>
		<pubDate>Sat, 31 Dec 2011 23:57:07 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=252#comment-15750</guid>
		<description>[...] The response is apparently answered in the post Dependency Injection Myth: Reference Passing [...]</description>
		<content:encoded><![CDATA[<p>[...] The response is apparently answered in the post Dependency Injection Myth: Reference Passing [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Using dependency injection in a PHP web application &#124; SeekPHP.com</title>
		<link>http://misko.hevery.com/2008/10/21/dependency-injection-myth-reference-passing/comment-page-1/#comment-11536</link>
		<dc:creator>Using dependency injection in a PHP web application &#124; SeekPHP.com</dc:creator>
		<pubDate>Thu, 27 Oct 2011 04:13:45 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=252#comment-11536</guid>
		<description>[...] to Miško Hevery, I should not be passing references to dependencies through the different layers of my application. [...]</description>
		<content:encoded><![CDATA[<p>[...] to Miško Hevery, I should not be passing references to dependencies through the different layers of my application. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Using dependency injection in a PHP web application &#124; Gravity Layouts</title>
		<link>http://misko.hevery.com/2008/10/21/dependency-injection-myth-reference-passing/comment-page-1/#comment-11535</link>
		<dc:creator>Using dependency injection in a PHP web application &#124; Gravity Layouts</dc:creator>
		<pubDate>Thu, 27 Oct 2011 03:36:30 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=252#comment-11535</guid>
		<description>[...] to Miško Hevery, I should not be passing references to dependencies through the different layers of my application. [...]</description>
		<content:encoded><![CDATA[<p>[...] to Miško Hevery, I should not be passing references to dependencies through the different layers of my application. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: misko</title>
		<link>http://misko.hevery.com/2008/10/21/dependency-injection-myth-reference-passing/comment-page-1/#comment-8386</link>
		<dc:creator>misko</dc:creator>
		<pubDate>Mon, 23 May 2011 19:56:02 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=252#comment-8386</guid>
		<description>@Yuriy,

I think this is already answered here; http://misko.hevery.com/2008/10/21/dependency-injection-myth-reference-passing/</description>
		<content:encoded><![CDATA[<p>@Yuriy,</p>
<p>I think this is already answered here; <a href="http://misko.hevery.com/2008/10/21/dependency-injection-myth-reference-passing/" rel="nofollow">http://misko.hevery.com/2008/10/21/dependency-injection-myth-reference-passing/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yuriy</title>
		<link>http://misko.hevery.com/2008/10/21/dependency-injection-myth-reference-passing/comment-page-1/#comment-8283</link>
		<dc:creator>Yuriy</dc:creator>
		<pubDate>Thu, 19 May 2011 09:04:33 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=252#comment-8283</guid>
		<description>Hi Misko, thanks for great article.
I really like the concept of DI, i just want to ask about one thing.

It seems to me,  passing Database to UserRepository constructor is violation of encapsulation and principle of minimal knowledge.
Why should i care (know) about where User object is come from and what is hidden underneath.

If we have House object that needs Windows and Doors, it looks clean, because Windows and Doors are in one layer with House.

But UserRepository and Database are from different layers. The same is for LoginPage and UserRepository.


What do you think about this? 


Thanks.</description>
		<content:encoded><![CDATA[<p>Hi Misko, thanks for great article.<br />
I really like the concept of DI, i just want to ask about one thing.</p>
<p>It seems to me,  passing Database to UserRepository constructor is violation of encapsulation and principle of minimal knowledge.<br />
Why should i care (know) about where User object is come from and what is hidden underneath.</p>
<p>If we have House object that needs Windows and Doors, it looks clean, because Windows and Doors are in one layer with House.</p>
<p>But UserRepository and Database are from different layers. The same is for LoginPage and UserRepository.</p>
<p>What do you think about this? </p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Singleton &#171; Blog HM</title>
		<link>http://misko.hevery.com/2008/10/21/dependency-injection-myth-reference-passing/comment-page-1/#comment-3792</link>
		<dc:creator>Singleton &#171; Blog HM</dc:creator>
		<pubDate>Sun, 25 Jul 2010 13:56:56 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=252#comment-3792</guid>
		<description>[...] Nếu tính chất “Singleton” không phải là bản chất của class, mà là do class dùng nó yêu cầu thế, thì tính duy nhất nên được hiện thực theo một cách độc lập, như Factory Method hay Dependency Injection. [...]</description>
		<content:encoded><![CDATA[<p>[...] Nếu tính chất “Singleton” không phải là bản chất của class, mà là do class dùng nó yêu cầu thế, thì tính duy nhất nên được hiện thực theo một cách độc lập, như Factory Method hay Dependency Injection. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Test Driven Development</title>
		<link>http://misko.hevery.com/2008/10/21/dependency-injection-myth-reference-passing/comment-page-1/#comment-2358</link>
		<dc:creator>Test Driven Development</dc:creator>
		<pubDate>Tue, 17 Nov 2009 16:34:09 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=252#comment-2358</guid>
		<description>[...] way I approach programming. When to use Dependency Injection, Guide to Writing Testable Code and Dependency Injection Myth: Reference Passing are some of the blog posts that I would definitely recommend [...]</description>
		<content:encoded><![CDATA[<p>[...] way I approach programming. When to use Dependency Injection, Guide to Writing Testable Code and Dependency Injection Myth: Reference Passing are some of the blog posts that I would definitely recommend [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: misko</title>
		<link>http://misko.hevery.com/2008/10/21/dependency-injection-myth-reference-passing/comment-page-1/#comment-1659</link>
		<dc:creator>misko</dc:creator>
		<pubDate>Fri, 14 Aug 2009 17:24:37 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=252#comment-1659</guid>
		<description>@Dave,

Logging is a weird case, because the information flows only one way, from your application to the logger. More importantly your application does not (should not behave any differently) if the logging is enabled or disabled. For this reason even thought logging is global state it will not hurt you, so I say just do Logger.getLog(...) right where you need it. However, if in your test you need to assert that a particular message did get written to a log, than you have no choice but to inject the logger through the constructor. GUICE will do this for you automatically.</description>
		<content:encoded><![CDATA[<p>@Dave,</p>
<p>Logging is a weird case, because the information flows only one way, from your application to the logger. More importantly your application does not (should not behave any differently) if the logging is enabled or disabled. For this reason even thought logging is global state it will not hurt you, so I say just do Logger.getLog(&#8230;) right where you need it. However, if in your test you need to assert that a particular message did get written to a log, than you have no choice but to inject the logger through the constructor. GUICE will do this for you automatically.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dave</title>
		<link>http://misko.hevery.com/2008/10/21/dependency-injection-myth-reference-passing/comment-page-1/#comment-1648</link>
		<dc:creator>dave</dc:creator>
		<pubDate>Thu, 13 Aug 2009 21:40:55 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=252#comment-1648</guid>
		<description>Misko, I agree best to request dependencies in the constructor for most case but how do you suggest DI for something as ubiquitous as a logging object? Since I think you advise against factories and I don&#039;t want to cascade the logging interface request into every constructor that might log, I&#039;m at a loss on how to do this efficiently and cleanly. I&#039;m thinking about using a proxy factory that a delegate must be set into by the production or the testing application.  If you recommend using a container, how is that different from a factory and how do you normally access that container from objects which may have been instantiated by a production vs. a testing container? Again the only way I can think of is to have a container proxy which has a delegate set into it by the actual container. Maybe container and factory are really the same thing? Thanks, Dave</description>
		<content:encoded><![CDATA[<p>Misko, I agree best to request dependencies in the constructor for most case but how do you suggest DI for something as ubiquitous as a logging object? Since I think you advise against factories and I don&#8217;t want to cascade the logging interface request into every constructor that might log, I&#8217;m at a loss on how to do this efficiently and cleanly. I&#8217;m thinking about using a proxy factory that a delegate must be set into by the production or the testing application.  If you recommend using a container, how is that different from a factory and how do you normally access that container from objects which may have been instantiated by a production vs. a testing container? Again the only way I can think of is to have a container proxy which has a delegate set into it by the actual container. Maybe container and factory are really the same thing? Thanks, Dave</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Giorgio Sironi</title>
		<link>http://misko.hevery.com/2008/10/21/dependency-injection-myth-reference-passing/comment-page-1/#comment-1120</link>
		<dc:creator>Giorgio Sironi</dc:creator>
		<pubDate>Wed, 27 May 2009 20:53:45 +0000</pubDate>
		<guid isPermaLink="false">http://misko.hevery.com/?p=252#comment-1120</guid>
		<description>@Misko:I found your article Where have all the singletons gone?... Translating in that example, I was worried that RequestFactory has to know about everything the objects it creates need. After coding I think it makes sense, even if RequestFactory creates third-level factories to pass in the constructor of objects that absolutely need to create their dependency dinamically. My coding was on a Mapper for database tables that needs to create a table Introspector for each record and subrecord it has to save. I resolved with a IntrospectorFactory.</description>
		<content:encoded><![CDATA[<p>@Misko:I found your article Where have all the singletons gone?&#8230; Translating in that example, I was worried that RequestFactory has to know about everything the objects it creates need. After coding I think it makes sense, even if RequestFactory creates third-level factories to pass in the constructor of objects that absolutely need to create their dependency dinamically. My coding was on a Mapper for database tables that needs to create a table Introspector for each record and subrecord it has to save. I resolved with a IntrospectorFactory.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

