<?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: Effective Tests: How Faking It Can Help You</title>
	<atom:link href="http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/feed/" rel="self" type="application/rss+xml" />
	<link>http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/</link>
	<description>pursuing well-crafted software</description>
	<lastBuildDate>Tue, 14 May 2013 13:08:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: AudreyBrooks</title>
		<link>http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/#comment-425</link>
		<dc:creator>AudreyBrooks</dc:creator>
		<pubDate>Thu, 08 Nov 2012 05:43:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/#comment-425</guid>
		<description>Been looking for this article for long time ago and finally found here. thanks for sharing this post. appreciate. </description>
		<content:encoded><![CDATA[<p>Been looking for this article for long time ago and finally found here. thanks for sharing this post. appreciate. </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jakub Linhart</title>
		<link>http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/#comment-229</link>
		<dc:creator>Jakub Linhart</dc:creator>
		<pubDate>Tue, 21 Jun 2011 09:04:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/#comment-229</guid>
		<description>It is not about ommiting refactoring phase but about NOT forgetting to refactor ALL faked parts. But you are right, it is better to try it out first and care about some fears then:).</description>
		<content:encoded><![CDATA[<p>It is not about ommiting refactoring phase but about NOT forgetting to refactor ALL faked parts. But you are right, it is better to try it out first and care about some fears then:).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derek Greer</title>
		<link>http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/#comment-228</link>
		<dc:creator>Derek Greer</dc:creator>
		<pubDate>Mon, 20 Jun 2011 15:32:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/#comment-228</guid>
		<description>Yes, when using the Fake It strategy for getting a test to pass quickly without following through with refactoring then you&#039;ll end up with code that is hard-wired to only satisfy the test scenarios used within your specifications.  Similarly, when you use the Obvious Implementation strategy without following through with refactoring then you&#039;ll end up with a lot of code duplication.  The key to both issues is not to avoid using these strategies, but to discipline yourself to follow the Test Driven Development methodology.  If you were to try Test Driven Development out for awhile, I think you would find your fears would be assuaged.</description>
		<content:encoded><![CDATA[<p>Yes, when using the Fake It strategy for getting a test to pass quickly without following through with refactoring then you&#8217;ll end up with code that is hard-wired to only satisfy the test scenarios used within your specifications.  Similarly, when you use the Obvious Implementation strategy without following through with refactoring then you&#8217;ll end up with a lot of code duplication.  The key to both issues is not to avoid using these strategies, but to discipline yourself to follow the Test Driven Development methodology.  If you were to try Test Driven Development out for awhile, I think you would find your fears would be assuaged.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jakub Linhart</title>
		<link>http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/#comment-227</link>
		<dc:creator>Jakub Linhart</dc:creator>
		<pubDate>Sun, 19 Jun 2011 10:31:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/#comment-227</guid>
		<description>Hi,
thanks you for very interesting post. &quot;Fake It&quot; promises to make some things easier but I am afraid that it could result in code crowded with &quot;Fake It&quot; parts because I just forgot to refactor them. Tests don&#039;t point out to them because they are all green (faked perfectly:). Negative feedback will then come from QA or even worse from the production.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
thanks you for very interesting post. &#8220;Fake It&#8221; promises to make some things easier but I am afraid that it could result in code crowded with &#8220;Fake It&#8221; parts because I just forgot to refactor them. Tests don&#8217;t point out to them because they are all green (faked perfectly:). Negative feedback will then come from QA or even worse from the production.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derek Greer</title>
		<link>http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/#comment-70</link>
		<dc:creator>Derek Greer</dc:creator>
		<pubDate>Thu, 07 Apr 2011 00:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/#comment-70</guid>
		<description>Peter,

  Again, I think you’re misunderstanding what refactoring means.  In the case of the first example, the functional requirements were for the game to put the player’s choice in the selected position when they go first.  I chose to verify this by checking that the selected position had an ‘X’ in it, made the test pass by hard-coding the GetPosition() method to always return ‘X’, and then refactored to eliminate the duplication between the value returned by the GetPosition() and the value being verified within the test.  Here is the important part: In the end, the behavior being verified by the specification did not change.   I think this is the key component you’re missing.  Refactoring isn’t the process of changing code without introducing new capabilities, it’s the process of changing code without changing the functional requirements.

The process of writing another failing test before introducing generalization, which you’re advocating, is referred to within Test-Driven Development as Triangulation.  While this is a legitimate technique, it isn’t set forth as a primary strategy for most cases. 

I appreciate that you’re trying to understand the rules and follow them to the letter, as this is often a necessary stage in skill acquisition.  I’m not that familiar with Roy’s approach to testing, but I would highly recommend you read the book: Test-Driven Development By Example.  The author, Kent Beck, created the Test Driven Development methodology.  After consulting his work, I believe you’ll find my example to be a faithful representation of his approach.

Moving beyond an appeal to authority however, what’s more valuable is to understand the reason and value in these techniques.  What value are we gaining from writing tests first?  What’s the value in Red/Green/Refactor?  What are the motivations behind using the strategies of Obvious Implementation, Fake It, and Triangulation?  What are the shortcomings?  When should you shift into “second gear”?  When should you downshift back to taking teeny-tiny steps?  Once you can answer these questions, you’ll be on the road to mastering TDD.

 Moreover, take from Kent Beck’s  TDD methodology, Dan North’s BDD methodology, Steve Freeman and Nat Pryce’s A-TDD methodology, Roy Osherove&#039;s methodology and all the styles, approaches, and theories in between and find a synthesis that helps you be an effective software engineer.

Cheers.</description>
		<content:encoded><![CDATA[<p>Peter,</p>
<p>  Again, I think you’re misunderstanding what refactoring means.  In the case of the first example, the functional requirements were for the game to put the player’s choice in the selected position when they go first.  I chose to verify this by checking that the selected position had an ‘X’ in it, made the test pass by hard-coding the GetPosition() method to always return ‘X’, and then refactored to eliminate the duplication between the value returned by the GetPosition() and the value being verified within the test.  Here is the important part: In the end, the behavior being verified by the specification did not change.   I think this is the key component you’re missing.  Refactoring isn’t the process of changing code without introducing new capabilities, it’s the process of changing code without changing the functional requirements.</p>
<p>The process of writing another failing test before introducing generalization, which you’re advocating, is referred to within Test-Driven Development as Triangulation.  While this is a legitimate technique, it isn’t set forth as a primary strategy for most cases. </p>
<p>I appreciate that you’re trying to understand the rules and follow them to the letter, as this is often a necessary stage in skill acquisition.  I’m not that familiar with Roy’s approach to testing, but I would highly recommend you read the book: Test-Driven Development By Example.  The author, Kent Beck, created the Test Driven Development methodology.  After consulting his work, I believe you’ll find my example to be a faithful representation of his approach.</p>
<p>Moving beyond an appeal to authority however, what’s more valuable is to understand the reason and value in these techniques.  What value are we gaining from writing tests first?  What’s the value in Red/Green/Refactor?  What are the motivations behind using the strategies of Obvious Implementation, Fake It, and Triangulation?  What are the shortcomings?  When should you shift into “second gear”?  When should you downshift back to taking teeny-tiny steps?  Once you can answer these questions, you’ll be on the road to mastering TDD.</p>
<p> Moreover, take from Kent Beck’s  TDD methodology, Dan North’s BDD methodology, Steve Freeman and Nat Pryce’s A-TDD methodology, Roy Osherove&#8217;s methodology and all the styles, approaches, and theories in between and find a synthesis that helps you be an effective software engineer.</p>
<p>Cheers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Polák</title>
		<link>http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/#comment-69</link>
		<dc:creator>Peter Polák</dc:creator>
		<pubDate>Wed, 06 Apr 2011 11:40:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/#comment-69</guid>
		<description>Hi Derek,

  thank you for your answer, I really appreciate the possibility to discuss TDD here on LosTechies.

  I begin by quoting you: &quot;What this guidance actually means is that we shouldn&#039;t begin implementing new requirements until a specification is written first&quot; - but isn&#039;t that exactly what you did? In the very first test of Part I, you got the test green by making GetPosition() return &#039;X&#039;. Then, in the refactoring phase, you implemented the requirement by adding _layout - without failing test. 

  What I believe you should have done was to write another test that would fail on that naïve GetPosition() implementation, thus forcing you to fix it - e.g. by adding the _layout member variable. Without the next text, your first test&#039;s requirement was fully implemented - so why bother with _layout?

  Replacing the &quot;fake it&quot; solution with some &quot;real&quot; implementation isn&#039;t refactoring, because - well, it changes the business logic. Before the change, your GetPosition() always returned &#039;X&#039;, no matter what. Afterwards, it returned the value of _layout. I believe refactoring should not change return values of methods like this. If I&#039;m wrong, then I must say I fail to tell the difference between refactoring and implementation.

  I&#039;ve been doing TDD for only a year now, so of course I may be wrong; but from what I know, the &quot;right&quot; way of doing it is to really implement only the requirements that are contained in the tests. This is what I learned from e.g. Roy Osherove&#039;s videos (then again, of course maybe I got it all wrong).</description>
		<content:encoded><![CDATA[<p>Hi Derek,</p>
<p>  thank you for your answer, I really appreciate the possibility to discuss TDD here on LosTechies.</p>
<p>  I begin by quoting you: &#8220;What this guidance actually means is that we shouldn&#8217;t begin implementing new requirements until a specification is written first&#8221; &#8211; but isn&#8217;t that exactly what you did? In the very first test of Part I, you got the test green by making GetPosition() return &#8216;X&#8217;. Then, in the refactoring phase, you implemented the requirement by adding _layout &#8211; without failing test. </p>
<p>  What I believe you should have done was to write another test that would fail on that naïve GetPosition() implementation, thus forcing you to fix it &#8211; e.g. by adding the _layout member variable. Without the next text, your first test&#8217;s requirement was fully implemented &#8211; so why bother with _layout?</p>
<p>  Replacing the &#8220;fake it&#8221; solution with some &#8220;real&#8221; implementation isn&#8217;t refactoring, because &#8211; well, it changes the business logic. Before the change, your GetPosition() always returned &#8216;X&#8217;, no matter what. Afterwards, it returned the value of _layout. I believe refactoring should not change return values of methods like this. If I&#8217;m wrong, then I must say I fail to tell the difference between refactoring and implementation.</p>
<p>  I&#8217;ve been doing TDD for only a year now, so of course I may be wrong; but from what I know, the &#8220;right&#8221; way of doing it is to really implement only the requirements that are contained in the tests. This is what I learned from e.g. Roy Osherove&#8217;s videos (then again, of course maybe I got it all wrong).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derek Greer</title>
		<link>http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/#comment-68</link>
		<dc:creator>Derek Greer</dc:creator>
		<pubDate>Tue, 05 Apr 2011 13:31:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/#comment-68</guid>
		<description>Thanks for taking the time to provide feedback, Peter.

First, let me commend you on having a keen sense of perception.  What you&#039;ve discovered is that in Test-Driven Development, much of the implementation of our solutions actually occurs during the refactoring phase.  To review, the steps of TDD are as follows:


1. Write a test.

2. Make it compile.

3. Run it to see that it fails.

4. Make it run.

5. Remove duplication.


This process is commonly shortened to Red/Green/Refactor.


Where I believe you&#039;ve misunderstood the Test-Driven Development process is in the Refactor step.  In general, refactoring is the process of making changes to an application&#039;s source code without modifying its functional requirements.  Refactoring can entail a number of changes, but the TDD process sets forth the elimination of duplication as the primary heuristic for guiding (and restricting) our modifications.  There have been a couple of cases where, during the refactoring phase, I&#039;ve extracted a method to help clarify the intent of the code emerging from my example, but for the most part changes have occurred solely to eliminate duplication.



Without a full grasp of the TDD process, The concept of not changing code without a failing test can actually be a little misleading.  In fact, it would be impossible to follow the TDD steps without doing this, as refactoring by definition is changing code and refactoring comes after the tests are passing.  What this guidance actually means is that we shouldn&#039;t begin implementing new requirements until a specification is written first.  If you review the steps you&#039;ve set forth in your comments, I think you&#039;ll discover that you are violating your own rule in that you recommend shaping up the code (unsure what this means exactly) after you&#039;ve made a test green, but before you&#039;ve written another test.

I hope this explanation helps. 
</description>
		<content:encoded><![CDATA[<p>Thanks for taking the time to provide feedback, Peter.</p>
<p>First, let me commend you on having a keen sense of perception.  What you&#8217;ve discovered is that in Test-Driven Development, much of the implementation of our solutions actually occurs during the refactoring phase.  To review, the steps of TDD are as follows:</p>
<p>1. Write a test.</p>
<p>2. Make it compile.</p>
<p>3. Run it to see that it fails.</p>
<p>4. Make it run.</p>
<p>5. Remove duplication.</p>
<p>This process is commonly shortened to Red/Green/Refactor.</p>
<p>Where I believe you&#8217;ve misunderstood the Test-Driven Development process is in the Refactor step.  In general, refactoring is the process of making changes to an application&#8217;s source code without modifying its functional requirements.  Refactoring can entail a number of changes, but the TDD process sets forth the elimination of duplication as the primary heuristic for guiding (and restricting) our modifications.  There have been a couple of cases where, during the refactoring phase, I&#8217;ve extracted a method to help clarify the intent of the code emerging from my example, but for the most part changes have occurred solely to eliminate duplication.</p>
<p>Without a full grasp of the TDD process, The concept of not changing code without a failing test can actually be a little misleading.  In fact, it would be impossible to follow the TDD steps without doing this, as refactoring by definition is changing code and refactoring comes after the tests are passing.  What this guidance actually means is that we shouldn&#8217;t begin implementing new requirements until a specification is written first.  If you review the steps you&#8217;ve set forth in your comments, I think you&#8217;ll discover that you are violating your own rule in that you recommend shaping up the code (unsure what this means exactly) after you&#8217;ve made a test green, but before you&#8217;ve written another test.</p>
<p>I hope this explanation helps. </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Polák</title>
		<link>http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/#comment-67</link>
		<dc:creator>Peter Polák</dc:creator>
		<pubDate>Tue, 05 Apr 2011 11:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/#comment-67</guid>
		<description>Hi Derek,

  I have no problem with &quot;faking it&quot;, but I don&#039;t understand why you actually do the implementation stuff in the refactoring phase. I know you call it eliminating duplicities, but to me it seems like you break one of the rules of TDD: you change production code without a failing test.

I believe the correct steps should be:
1) write failing test
2) make it green
3) refactor - where &quot;refactor&quot; really means to refactor the code: to shape it up without changing the business logic.

What you seem to be doing is:
1) write failing test
2) make it green
3) change the business logic to suit your purpose (without writing any more tests)
4) refactor

I believe there should be at least another failing test between 2) and 3).</description>
		<content:encoded><![CDATA[<p>Hi Derek,</p>
<p>  I have no problem with &#8220;faking it&#8221;, but I don&#8217;t understand why you actually do the implementation stuff in the refactoring phase. I know you call it eliminating duplicities, but to me it seems like you break one of the rules of TDD: you change production code without a failing test.</p>
<p>I believe the correct steps should be:<br />
1) write failing test<br />
2) make it green<br />
3) refactor &#8211; where &#8220;refactor&#8221; really means to refactor the code: to shape it up without changing the business logic.</p>
<p>What you seem to be doing is:<br />
1) write failing test<br />
2) make it green<br />
3) change the business logic to suit your purpose (without writing any more tests)<br />
4) refactor</p>
<p>I believe there should be at least another failing test between 2) and 3).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The Morning Brew - Chris Alcock &#187; The Morning Brew #823</title>
		<link>http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/#comment-62</link>
		<dc:creator>The Morning Brew - Chris Alcock &#187; The Morning Brew #823</dc:creator>
		<pubDate>Wed, 30 Mar 2011 07:21:45 +0000</pubDate>
		<guid isPermaLink="false">http://lostechies.com/derekgreer/2011/03/29/effective-tests-how-faking-it-can-help-you/#comment-62</guid>
		<description>[...] Effective Tests: How Faking It Can Help You - Derek Greer continues his series of posts on Effective Tests with a deeper discussion of the use of fake implementations to get tests to pass. [...]</description>
		<content:encoded><![CDATA[<p>[...] Effective Tests: How Faking It Can Help You &#8211; Derek Greer continues his series of posts on Effective Tests with a deeper discussion of the use of fake implementations to get tests to pass. [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
