<?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: How to Think About the &#8220;new&#8221; Operator with Respect to Unit Testing</title>
	<atom:link href="http://misko.hevery.com/2008/07/08/how-to-think-about-the-new-operator/feed/" rel="self" type="application/rss+xml" />
	<link>http://misko.hevery.com/2008/07/08/how-to-think-about-the-new-operator/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-think-about-the-new-operator</link>
	<description>Testability Explorer</description>
	<lastBuildDate>Fri, 28 Jun 2013 07:36:19 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.2</generator>
	<item>
		<title>By: Brian</title>
		<link>http://misko.hevery.com/2008/07/08/how-to-think-about-the-new-operator/comment-page-1/#comment-74959</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Wed, 01 May 2013 23:31:49 +0000</pubDate>
		<guid isPermaLink="false">http://s90424825.onlinehome.us/blog/?p=41#comment-74959</guid>
		<description><![CDATA[If you aren&#039;t using a dependency injection pattern and have already successfully tested all the leafs of a branch, are you not safe to test the branch despite it not being in isolation?]]></description>
		<content:encoded><![CDATA[<p>If you aren&#8217;t using a dependency injection pattern and have already successfully tested all the leafs of a branch, are you not safe to test the branch despite it not being in isolation?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Romain</title>
		<link>http://misko.hevery.com/2008/07/08/how-to-think-about-the-new-operator/comment-page-1/#comment-52117</link>
		<dc:creator>Romain</dc:creator>
		<pubDate>Wed, 19 Dec 2012 17:44:39 +0000</pubDate>
		<guid isPermaLink="false">http://s90424825.onlinehome.us/blog/?p=41#comment-52117</guid>
		<description><![CDATA[Hi,

Thank you for this article, it is really great.

I have one question though. How will you unit-test you Main class ? (Maybe you would say that you don&#039;t unit-test a Main class, but in this case what if you call your &quot;new ApplicationBuilder().build()&quot; in another class that you habe to unit test ?)

Would you use a DI framework to inject the builder to the classes that need it ?

Thanks for all your articles ! All those subjects about testing are really interesting, unfortunately industry seems not to care that much about them. 

Romain.]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Thank you for this article, it is really great.</p>
<p>I have one question though. How will you unit-test you Main class ? (Maybe you would say that you don&#8217;t unit-test a Main class, but in this case what if you call your &#8220;new ApplicationBuilder().build()&#8221; in another class that you habe to unit test ?)</p>
<p>Would you use a DI framework to inject the builder to the classes that need it ?</p>
<p>Thanks for all your articles ! All those subjects about testing are really interesting, unfortunately industry seems not to care that much about them. </p>
<p>Romain.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ruby (programming language): What Ruby conventions explicitly avoid mixing object graph construction &#38; application logic? - Quora</title>
		<link>http://misko.hevery.com/2008/07/08/how-to-think-about-the-new-operator/comment-page-1/#comment-31009</link>
		<dc:creator>Ruby (programming language): What Ruby conventions explicitly avoid mixing object graph construction &#38; application logic? - Quora</dc:creator>
		<pubDate>Sat, 21 Jul 2012 19:58:35 +0000</pubDate>
		<guid isPermaLink="false">http://s90424825.onlinehome.us/blog/?p=41#comment-31009</guid>
		<description><![CDATA[[...] mixing object graph construction &amp; application logic?I&#039;ve been reading Miško Hevery -- http://misko.hevery.com/2008/07/...Post &#160;&#160;Add AnswerBIU&#160;&#160;&#160;&#160;&#160;@&#160;&#160;&#160;&#160;&#160; [...]]]></description>
		<content:encoded><![CDATA[<p>[...] mixing object graph construction &amp; application logic?I&#039;ve been reading Miško Hevery &#8212; <a href="http://misko.hevery.com/2008/07/" rel="nofollow">http://misko.hevery.com/2008/07/</a>&#8230;Post &nbsp;&nbsp;Add AnswerBIU&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://misko.hevery.com/2008/07/08/how-to-think-about-the-new-operator/comment-page-1/#comment-22062</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Mon, 09 Apr 2012 13:59:53 +0000</pubDate>
		<guid isPermaLink="false">http://s90424825.onlinehome.us/blog/?p=41#comment-22062</guid>
		<description><![CDATA[I have been scratching my head and searching the web trying to understand where &#039;new&#039; fits inside the object graph and now I finally get it. Thank you so much for this very well written, easy to understand article.]]></description>
		<content:encoded><![CDATA[<p>I have been scratching my head and searching the web trying to understand where &#8216;new&#8217; fits inside the object graph and now I finally get it. Thank you so much for this very well written, easy to understand article.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Asbjørn</title>
		<link>http://misko.hevery.com/2008/07/08/how-to-think-about-the-new-operator/comment-page-1/#comment-10242</link>
		<dc:creator>Asbjørn</dc:creator>
		<pubDate>Wed, 07 Sep 2011 12:45:17 +0000</pubDate>
		<guid isPermaLink="false">http://s90424825.onlinehome.us/blog/?p=41#comment-10242</guid>
		<description><![CDATA[How about using a mock/stub tool that doesn&#039;t require DI?]]></description>
		<content:encoded><![CDATA[<p>How about using a mock/stub tool that doesn&#8217;t require DI?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: misko</title>
		<link>http://misko.hevery.com/2008/07/08/how-to-think-about-the-new-operator/comment-page-1/#comment-8688</link>
		<dc:creator>misko</dc:creator>
		<pubDate>Sun, 05 Jun 2011 18:24:02 +0000</pubDate>
		<guid isPermaLink="false">http://s90424825.onlinehome.us/blog/?p=41#comment-8688</guid>
		<description><![CDATA[@Morl99,

No, value objects do not need to be separate their news. More discussion here: http://misko.hevery.com/2008/09/30/to-new-or-not-to-new/]]></description>
		<content:encoded><![CDATA[<p>@Morl99,</p>
<p>No, value objects do not need to be separate their news. More discussion here: <a href="http://misko.hevery.com/2008/09/30/to-new-or-not-to-new/" rel="nofollow">http://misko.hevery.com/2008/09/30/to-new-or-not-to-new/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Morl99</title>
		<link>http://misko.hevery.com/2008/07/08/how-to-think-about-the-new-operator/comment-page-1/#comment-8525</link>
		<dc:creator>Morl99</dc:creator>
		<pubDate>Tue, 31 May 2011 12:54:57 +0000</pubDate>
		<guid isPermaLink="false">http://s90424825.onlinehome.us/blog/?p=41#comment-8525</guid>
		<description><![CDATA[@misko

just read all the blogposts about this topic. Great stuff, I really liked those and I hope I remember to send them to my friends!

I have a question though, do you believe, that the separation of Object Construction and Logic should even be valid for standard library Objects such as Collections? If I need a queue for storing incoming Messages, would it be a violation to your rules to write
messageQueue = new Queue( );
inside the Constructor of my Class?

I would really like to hear your opinion on that. I suspect, that it is the best way to handle this, because the Queue (or any other Standard Library Object) is completly tied to my Class, even when Unit Testing.

Keep it up!]]></description>
		<content:encoded><![CDATA[<p>@misko</p>
<p>just read all the blogposts about this topic. Great stuff, I really liked those and I hope I remember to send them to my friends!</p>
<p>I have a question though, do you believe, that the separation of Object Construction and Logic should even be valid for standard library Objects such as Collections? If I need a queue for storing incoming Messages, would it be a violation to your rules to write<br />
messageQueue = new Queue( );<br />
inside the Constructor of my Class?</p>
<p>I would really like to hear your opinion on that. I suspect, that it is the best way to handle this, because the Queue (or any other Standard Library Object) is completly tied to my Class, even when Unit Testing.</p>
<p>Keep it up!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: misko</title>
		<link>http://misko.hevery.com/2008/07/08/how-to-think-about-the-new-operator/comment-page-1/#comment-8027</link>
		<dc:creator>misko</dc:creator>
		<pubDate>Thu, 05 May 2011 16:20:46 +0000</pubDate>
		<guid isPermaLink="false">http://s90424825.onlinehome.us/blog/?p=41#comment-8027</guid>
		<description><![CDATA[@Oz,

The cost of DI is arguments is a myth of not taking DI to its extreme: http://misko.hevery.com/2008/10/21/dependency-injection-myth-reference-passing/

What you have suggested at first looks like a good idea, and as long as you look at the class in isolation it is. The trouble becomes when you are testing house which needs kitchen. Since house will call the default constructor it is easy to cross the line and have the whole thing become the same as not having DI, so in practice this dose not work.]]></description>
		<content:encoded><![CDATA[<p>@Oz,</p>
<p>The cost of DI is arguments is a myth of not taking DI to its extreme: <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>
<p>What you have suggested at first looks like a good idea, and as long as you look at the class in isolation it is. The trouble becomes when you are testing house which needs kitchen. Since house will call the default constructor it is easy to cross the line and have the whole thing become the same as not having DI, so in practice this dose not work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: OZ</title>
		<link>http://misko.hevery.com/2008/07/08/how-to-think-about-the-new-operator/comment-page-1/#comment-7869</link>
		<dc:creator>OZ</dc:creator>
		<pubDate>Tue, 26 Apr 2011 13:31:12 +0000</pubDate>
		<guid isPermaLink="false">http://s90424825.onlinehome.us/blog/?p=41#comment-7869</guid>
		<description><![CDATA[First: Thank you for your lessons, I become understand much more.

I agree, that DI is much more flexible way, but anything has it&#039;s cost, and cost of using DI is lot of passed arguments.

What if we will build class both flexible (able to be isolated) and self-enough?
My example will be in PHP, not Java, excuse me for this, but I hope syntax not so different:

class House
{
    private $kitchen;
    
    public function __construct(IKitchen $Kitchen = null)
    {
        if (empty($Kitchen)) $Kitchen = new BaseKitchen();
        else $this-&gt;kitchen = $Kitchen;
    }
}

this class can be created with empty constructor, which can be very handy in many situations, and it will be decrease count of not necessary initializations of Kitchen object in code.
In other hand, this object can be created with special version of Kitchen (e.g. mock-object) in tests.

Please, comment, what do you think about this variant.]]></description>
		<content:encoded><![CDATA[<p>First: Thank you for your lessons, I become understand much more.</p>
<p>I agree, that DI is much more flexible way, but anything has it&#8217;s cost, and cost of using DI is lot of passed arguments.</p>
<p>What if we will build class both flexible (able to be isolated) and self-enough?<br />
My example will be in PHP, not Java, excuse me for this, but I hope syntax not so different:</p>
<p>class House<br />
{<br />
    private $kitchen;</p>
<p>    public function __construct(IKitchen $Kitchen = null)<br />
    {<br />
        if (empty($Kitchen)) $Kitchen = new BaseKitchen();<br />
        else $this-&gt;kitchen = $Kitchen;<br />
    }<br />
}</p>
<p>this class can be created with empty constructor, which can be very handy in many situations, and it will be decrease count of not necessary initializations of Kitchen object in code.<br />
In other hand, this object can be created with special version of Kitchen (e.g. mock-object) in tests.</p>
<p>Please, comment, what do you think about this variant.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Objective-C: Frustrations of a Java Programmer &#124; richardrauser.com</title>
		<link>http://misko.hevery.com/2008/07/08/how-to-think-about-the-new-operator/comment-page-1/#comment-3702</link>
		<dc:creator>Objective-C: Frustrations of a Java Programmer &#124; richardrauser.com</dc:creator>
		<pubDate>Wed, 07 Jul 2010 18:08:47 +0000</pubDate>
		<guid isPermaLink="false">http://s90424825.onlinehome.us/blog/?p=41#comment-3702</guid>
		<description><![CDATA[[...] 9. Unit testing: OCUnit and OCMock are fairly immature compared to jUnit and jMock. And furthermore, a number of Cocoa classes include real work in their &#8220;constructors.&#8221; For instance, NSUrlConnection actually opens an HTTP connection and interacts online in its initWithRequest:delegate: method. The problem this creates is that object creation is tied to real work. This makes dependency injection difficult because we can&#8217;t separate the creation of the object from the logic, which would be required in order to substitute a test stub with test logic in its place. Dang. For more on this, see Misko Hevery&#8217;s great article on unit testing, object creation and logic. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] 9. Unit testing: OCUnit and OCMock are fairly immature compared to jUnit and jMock. And furthermore, a number of Cocoa classes include real work in their &#8220;constructors.&#8221; For instance, NSUrlConnection actually opens an HTTP connection and interacts online in its initWithRequest:delegate: method. The problem this creates is that object creation is tied to real work. This makes dependency injection difficult because we can&#8217;t separate the creation of the object from the logic, which would be required in order to substitute a test stub with test logic in its place. Dang. For more on this, see Misko Hevery&#8217;s great article on unit testing, object creation and logic. [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
