<?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: TDD: Hungarian notation for mocks/stubs</title>
	<atom:link href="http://www.markhneedham.com/blog/2010/01/06/tdd-hungarian-notation-for-mocksstubs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markhneedham.com/blog/2010/01/06/tdd-hungarian-notation-for-mocksstubs/</link>
	<description>Thoughts on Software Development</description>
	<lastBuildDate>Sat, 11 Feb 2012 23:17: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: Andy Palmer</title>
		<link>http://www.markhneedham.com/blog/2010/01/06/tdd-hungarian-notation-for-mocksstubs/comment-page-1/#comment-29927</link>
		<dc:creator>Andy Palmer</dc:creator>
		<pubDate>Fri, 08 Jan 2010 00:55:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2002#comment-29927</guid>
		<description>@MM I have used a number of different test double type names (including fake) when that is how I am using it... I think this might be introducing more noise than I need.
On the other hand, I use dummySomething to specifically indicate that this is not being used in this test... if a test fails because a mock didn&#039;t respond correctly and it&#039;s called dummySomething, that gives me a clue that something new is happening in the real code :-)</description>
		<content:encoded><![CDATA[<p>@MM I have used a number of different test double type names (including fake) when that is how I am using it&#8230; I think this might be introducing more noise than I need.<br />
On the other hand, I use dummySomething to specifically indicate that this is not being used in this test&#8230; if a test fails because a mock didn&#8217;t respond correctly and it&#8217;s called dummySomething, that gives me a clue that something new is happening in the real code <img src='http://www.markhneedham.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brent Snook</title>
		<link>http://www.markhneedham.com/blog/2010/01/06/tdd-hungarian-notation-for-mocksstubs/comment-page-1/#comment-29876</link>
		<dc:creator>Brent Snook</dc:creator>
		<pubDate>Wed, 06 Jan 2010 14:56:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2002#comment-29876</guid>
		<description>I like to name the variable for the role the object is acting in too, I agree that &quot;mock&quot; or &quot;stub&quot; is unecessary noise.

I&#039;m only interested in the role something is playing and the interactions it has; I don&#039;t care what it is. What the thing is actually is (mock, stub, spy) is something I find only changes as the code changes so I want that detail to leak into the test as little as possible.</description>
		<content:encoded><![CDATA[<p>I like to name the variable for the role the object is acting in too, I agree that &#8220;mock&#8221; or &#8220;stub&#8221; is unecessary noise.</p>
<p>I&#8217;m only interested in the role something is playing and the interactions it has; I don&#8217;t care what it is. What the thing is actually is (mock, stub, spy) is something I find only changes as the code changes so I want that detail to leak into the test as little as possible.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MM</title>
		<link>http://www.markhneedham.com/blog/2010/01/06/tdd-hungarian-notation-for-mocksstubs/comment-page-1/#comment-29873</link>
		<dc:creator>MM</dc:creator>
		<pubDate>Wed, 06 Jan 2010 14:36:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2002#comment-29873</guid>
		<description>I also favor not specifying whether the dependency is a mock or stub. However, if I feel the need to make it clear that it is not &quot;real&quot; code being used, I like to just use the word fake. So I would use &quot;someFakeDependency&quot;. I guess this is similar to Andy&#039;s idea of using &quot;dummy&quot; but to me &quot;fake&quot; is more a part of the testing lexicon.</description>
		<content:encoded><![CDATA[<p>I also favor not specifying whether the dependency is a mock or stub. However, if I feel the need to make it clear that it is not &#8220;real&#8221; code being used, I like to just use the word fake. So I would use &#8220;someFakeDependency&#8221;. I guess this is similar to Andy&#8217;s idea of using &#8220;dummy&#8221; but to me &#8220;fake&#8221; is more a part of the testing lexicon.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Colin Jack</title>
		<link>http://www.markhneedham.com/blog/2010/01/06/tdd-hungarian-notation-for-mocksstubs/comment-page-1/#comment-29872</link>
		<dc:creator>Colin Jack</dc:creator>
		<pubDate>Wed, 06 Jan 2010 14:34:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2002#comment-29872</guid>
		<description>When looking at a test I personally want to know where an object is a test double. However I&#039;m not bothered whether its specifically a stub or mock (far better seeing that from its usage), I&#039;d be happy with one or other term used consistently or just use of nameTestDouble.</description>
		<content:encoded><![CDATA[<p>When looking at a test I personally want to know where an object is a test double. However I&#8217;m not bothered whether its specifically a stub or mock (far better seeing that from its usage), I&#8217;d be happy with one or other term used consistently or just use of nameTestDouble.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron Jensen</title>
		<link>http://www.markhneedham.com/blog/2010/01/06/tdd-hungarian-notation-for-mocksstubs/comment-page-1/#comment-29860</link>
		<dc:creator>Aaron Jensen</dc:creator>
		<pubDate>Wed, 06 Jan 2010 08:26:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2002#comment-29860</guid>
		<description>Mark,

My personal preference is to just never use CreateMock. In my mind, instances are not mocks or stubs--you either stub or mock methods. It&#039;s entirely possible to stub MethodA on IFoo and mock MethodB. 

Rhino makes this easy--just use CreateStub (always) and use .Stub or .AssertWasCalled. CreateMock causes more coupling than I think is healthy in a test. If you want to assert that something was not called, use AssertWasNotCalled. It&#039;s very rare that I actually want to spec out that *nothing* was called on a dependency other than one thing. That&#039;s just the kind of coupling that leads to brittle unit tests.

Oh and back to the point of your post, I don&#039;t like the suffix either. It is what it is, the fact that parts of it are mocked or stubbed is evident by the .Stub or .AssertWasCalled calls.</description>
		<content:encoded><![CDATA[<p>Mark,</p>
<p>My personal preference is to just never use CreateMock. In my mind, instances are not mocks or stubs&#8211;you either stub or mock methods. It&#8217;s entirely possible to stub MethodA on IFoo and mock MethodB. </p>
<p>Rhino makes this easy&#8211;just use CreateStub (always) and use .Stub or .AssertWasCalled. CreateMock causes more coupling than I think is healthy in a test. If you want to assert that something was not called, use AssertWasNotCalled. It&#8217;s very rare that I actually want to spec out that *nothing* was called on a dependency other than one thing. That&#8217;s just the kind of coupling that leads to brittle unit tests.</p>
<p>Oh and back to the point of your post, I don&#8217;t like the suffix either. It is what it is, the fact that parts of it are mocked or stubbed is evident by the .Stub or .AssertWasCalled calls.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2010/01/06/tdd-hungarian-notation-for-mocksstubs/comment-page-1/#comment-29858</link>
		<dc:creator>Mark Needham</dc:creator>
		<pubDate>Wed, 06 Jan 2010 07:42:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2002#comment-29858</guid>
		<description>@Perryn ah that&#039;s interesting I hadn&#039;t thought of it from that perspective. That makes sense.

@Andy hmmm that&#039;s a cool idea, don&#039;t think I&#039;ve seen that so explicitly done before. Might give that one a try!

@Mark I think I might have seen that but I&#039;d need to re-read it. Do you have a link to it?</description>
		<content:encoded><![CDATA[<p>@Perryn ah that&#8217;s interesting I hadn&#8217;t thought of it from that perspective. That makes sense.</p>
<p>@Andy hmmm that&#8217;s a cool idea, don&#8217;t think I&#8217;ve seen that so explicitly done before. Might give that one a try!</p>
<p>@Mark I think I might have seen that but I&#8217;d need to re-read it. Do you have a link to it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Palmer</title>
		<link>http://www.markhneedham.com/blog/2010/01/06/tdd-hungarian-notation-for-mocksstubs/comment-page-1/#comment-29847</link>
		<dc:creator>Andy Palmer</dc:creator>
		<pubDate>Wed, 06 Jan 2010 01:24:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2002#comment-29847</guid>
		<description>I tend to use mockSomething or stubSomething, but I think I might drop that.

One thing I do with Mockito is create &quot;mocks&quot; of dependencies I don&#039;t care about for this test and call them dummySomething. I do this rather than pass in null (&lt;a href=&quot;http://andypalmer.com/2008/08/returning-null-considered-dishonest&quot; rel=&quot;nofollow&quot;&gt;don&#039;t get me started on null =)&lt;/a&gt;)</description>
		<content:encoded><![CDATA[<p>I tend to use mockSomething or stubSomething, but I think I might drop that.</p>
<p>One thing I do with Mockito is create &#8220;mocks&#8221; of dependencies I don&#8217;t care about for this test and call them dummySomething. I do this rather than pass in null (<a href="http://andypalmer.com/2008/08/returning-null-considered-dishonest" rel="nofollow">don&#8217;t get me started on null =)</a>)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Perryn Fowler</title>
		<link>http://www.markhneedham.com/blog/2010/01/06/tdd-hungarian-notation-for-mocksstubs/comment-page-1/#comment-29843</link>
		<dc:creator>Perryn Fowler</dc:creator>
		<pubDate>Wed, 06 Jan 2010 00:55:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2002#comment-29843</guid>
		<description>Hi Mark,

I tent to agree with you, however I sometimes use the &#039;hungarian notation&#039; approach when coaching people who are new to mocking and stubbing and who can often have trouble distinguishing between what is a mock and what is a real object in even quite simple tests.

I find it helps avoid a surprisingly common problem with beginners where they set an expectation, and then fulfill that expectation in the test rather than in the implementation.

Also, then if I come across a test with a stub mislabeled as a mock then that gives me a clue that the person that wrote it is having trouble understanding the difference.</description>
		<content:encoded><![CDATA[<p>Hi Mark,</p>
<p>I tent to agree with you, however I sometimes use the &#8216;hungarian notation&#8217; approach when coaching people who are new to mocking and stubbing and who can often have trouble distinguishing between what is a mock and what is a real object in even quite simple tests.</p>
<p>I find it helps avoid a surprisingly common problem with beginners where they set an expectation, and then fulfill that expectation in the test rather than in the implementation.</p>
<p>Also, then if I come across a test with a stub mislabeled as a mock then that gives me a clue that the person that wrote it is having trouble understanding the difference.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Nijhof</title>
		<link>http://www.markhneedham.com/blog/2010/01/06/tdd-hungarian-notation-for-mocksstubs/comment-page-1/#comment-29842</link>
		<dc:creator>Mark Nijhof</dc:creator>
		<pubDate>Wed, 06 Jan 2010 00:48:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2002#comment-29842</guid>
		<description>Interesting, I like adding Mock to the end of the mocked dependency exactly because then I don&#039;t have to go where it was assigned but can just read the test. Also for small tests. Have you seen my Specifications post? There I auto mocks and use a different way to acces the mocks using a small DSL. What are your thoughts on that?</description>
		<content:encoded><![CDATA[<p>Interesting, I like adding Mock to the end of the mocked dependency exactly because then I don&#8217;t have to go where it was assigned but can just read the test. Also for small tests. Have you seen my Specifications post? There I auto mocks and use a different way to acces the mocks using a small DSL. What are your thoughts on that?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

