<?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: Testability vs coupling</title>
	<atom:link href="http://henko.net/imperfection/testability-vs-coupling/feed/" rel="self" type="application/rss+xml" />
	<link>http://henko.net/imperfection/testability-vs-coupling/</link>
	<description>Home of a human being and software developer</description>
	<lastBuildDate>Sun, 27 Nov 2011 18:38:40 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Henrik Jernevad</title>
		<link>http://henko.net/imperfection/testability-vs-coupling/comment-page-1/#comment-54938</link>
		<dc:creator>Henrik Jernevad</dc:creator>
		<pubDate>Wed, 02 Mar 2011 14:20:50 +0000</pubDate>
		<guid isPermaLink="false">http://henko.net/imperfection/testability-vs-coupling/#comment-54938</guid>
		<description>&lt;p&gt;Thank you for your comment Rogério!&lt;/p&gt;

&lt;p&gt;I agree that having a unit test creates no real problem with regards to coupling. Providing a dependency really just makes the existing &quot;hidden&quot; coupling more visible.&lt;/p&gt;

&lt;p&gt;But what do you do when you mock if not “create another object of the same type as Dependency”? The object/type is created at runtime, of course, but still, it is precisely what you do. :-)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thank you for your comment Rogério!</p>

<p>I agree that having a unit test creates no real problem with regards to coupling. Providing a dependency really just makes the existing &#8220;hidden&#8221; coupling more visible.</p>

<p>But what do you do when you mock if not “create another object of the same type as Dependency”? The object/type is created at runtime, of course, but still, it is precisely what you do. <img src='http://henko.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>]]></content:encoded>
	</item>
	<item>
		<title>By: Rogério Liesenfeld</title>
		<link>http://henko.net/imperfection/testability-vs-coupling/comment-page-1/#comment-54934</link>
		<dc:creator>Rogério Liesenfeld</dc:creator>
		<pubDate>Wed, 02 Mar 2011 12:34:08 +0000</pubDate>
		<guid isPermaLink="false">http://henko.net/imperfection/testability-vs-coupling/#comment-54934</guid>
		<description>&lt;p&gt;Great post!&lt;/p&gt;

&lt;p&gt;However, to test ClassUnderTest in isolation from an internally instantiated Dependency, it&#039;s not necessary to &quot;create another object of the same type as Dependency&quot;. You can instead simply &lt;em&gt;mock&lt;/em&gt; the Dependency class, allowing the test to specify the behavior that ClassUnderTest will see from that internal Dependency instance.&lt;/p&gt;

&lt;p&gt;So, the (unit) test for ClassUnderTest will only need to reflect the &lt;em&gt;simple-object&lt;/em&gt; and &lt;em&gt;simple-data-parameter&lt;/em&gt; forms of coupling on Dependency, not any &lt;em&gt;semantic&lt;/em&gt; coupling. That is, the unit test will have no knowledge about the &quot;inner workings&quot; of the Dependency.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Great post!</p>

<p>However, to test ClassUnderTest in isolation from an internally instantiated Dependency, it&#8217;s not necessary to &#8220;create another object of the same type as Dependency&#8221;. You can instead simply <em>mock</em> the Dependency class, allowing the test to specify the behavior that ClassUnderTest will see from that internal Dependency instance.</p>

<p>So, the (unit) test for ClassUnderTest will only need to reflect the <em>simple-object</em> and <em>simple-data-parameter</em> forms of coupling on Dependency, not any <em>semantic</em> coupling. That is, the unit test will have no knowledge about the &#8220;inner workings&#8221; of the Dependency.</p>]]></content:encoded>
	</item>
</channel>
</rss>

