<?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: Legacy-TDD: Coach &#8216;Not Knowing&#8217;</title>
	<atom:link href="http://anarchycreek.com/2010/02/18/legacy-tdd-coach-not-knowing/feed/" rel="self" type="application/rss+xml" />
	<link>http://anarchycreek.com/2010/02/18/legacy-tdd-coach-not-knowing/</link>
	<description>Towards a Way of Excellence</description>
	<lastBuildDate>Fri, 06 Jan 2012 00:33:30 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: GeePawHill</title>
		<link>http://anarchycreek.com/2010/02/18/legacy-tdd-coach-not-knowing/comment-page-1/#comment-1018</link>
		<dc:creator>GeePawHill</dc:creator>
		<pubDate>Sun, 28 Feb 2010 22:27:28 +0000</pubDate>
		<guid isPermaLink="false">http://anarchycreek.com/?p=1128#comment-1018</guid>
		<description>Matteo: That&#039;s absolutely right. The E&amp;O is a *hack*. Properly TDD&#039;d greenfield code should never involve having to do one. I use it almost entirely for that first rush to bring a legacy class under some kind of control. It would never be an end-goal of a refactoring.

Repeat: E&amp;O is a hack. Capability to E&amp;O is *not* a final result on an object, just an instrumental one. --Hill</description>
		<content:encoded><![CDATA[<p>Matteo: That&#8217;s absolutely right. The E&amp;O is a *hack*. Properly TDD&#8217;d greenfield code should never involve having to do one. I use it almost entirely for that first rush to bring a legacy class under some kind of control. It would never be an end-goal of a refactoring.</p>
<p>Repeat: E&amp;O is a hack. Capability to E&amp;O is *not* a final result on an object, just an instrumental one. &#8211;Hill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matteo Vaccari</title>
		<link>http://anarchycreek.com/2010/02/18/legacy-tdd-coach-not-knowing/comment-page-1/#comment-1017</link>
		<dc:creator>Matteo Vaccari</dc:creator>
		<pubDate>Sun, 28 Feb 2010 09:17:24 +0000</pubDate>
		<guid isPermaLink="false">http://anarchycreek.com/?p=1128#comment-1017</guid>
		<description>Just make sure you explain that E&amp;O is a hack for legacy code.  It is not the recommended way to go for green code.  I&#039;ve been burned myself by this confusion :-/</description>
		<content:encoded><![CDATA[<p>Just make sure you explain that E&amp;O is a hack for legacy code.  It is not the recommended way to go for green code.  I&#8217;ve been burned myself by this confusion :-/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GeePawHill</title>
		<link>http://anarchycreek.com/2010/02/18/legacy-tdd-coach-not-knowing/comment-page-1/#comment-1012</link>
		<dc:creator>GeePawHill</dc:creator>
		<pubDate>Wed, 24 Feb 2010 22:19:03 +0000</pubDate>
		<guid isPermaLink="false">http://anarchycreek.com/?p=1128#comment-1012</guid>
		<description>I totally get this, because I&#039;m sure your situation meets my two caveats: only if you are an experienced microtester already, and only if you know to attack duplication already.
Obviously, you pass with flying colors. :)
Inexperienced microtesters always think they might just as well go end-to-end, which keeps them from learning how to microtest, and inexperienced refactorers always think the best way to get the new end-to-end test running is to copy the old one and change two lines, with the usual consequences multiplied by the obscurities of getting the whole system to run.
Seeya, Hill</description>
		<content:encoded><![CDATA[<p>I totally get this, because I&#8217;m sure your situation meets my two caveats: only if you are an experienced microtester already, and only if you know to attack duplication already.<br />
Obviously, you pass with flying colors. <img src='http://anarchycreek.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Inexperienced microtesters always think they might just as well go end-to-end, which keeps them from learning how to microtest, and inexperienced refactorers always think the best way to get the new end-to-end test running is to copy the old one and change two lines, with the usual consequences multiplied by the obscurities of getting the whole system to run.<br />
Seeya, Hill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Grigg</title>
		<link>http://anarchycreek.com/2010/02/18/legacy-tdd-coach-not-knowing/comment-page-1/#comment-1011</link>
		<dc:creator>Jeff Grigg</dc:creator>
		<pubDate>Wed, 24 Feb 2010 01:54:11 +0000</pubDate>
		<guid isPermaLink="false">http://anarchycreek.com/?p=1128#comment-1011</guid>
		<description>Yes, I find micro tests easier to write, so they give better ROI... until they inhibit major refactorings.  I work a lot with legacy code, so I&#039;m shooting for *MAJOR* refactorings.  That makes end-to-end tests much more attractive to me:  I&#039;m likely to rip the guts out of the thing, changing its implementation radically.  So I want my automated regression tests to be remarkably ignorant of what&#039;s going on in the middle layers -- because it&#039;s going to change.  ;-&gt;</description>
		<content:encoded><![CDATA[<p>Yes, I find micro tests easier to write, so they give better ROI&#8230; until they inhibit major refactorings.  I work a lot with legacy code, so I&#8217;m shooting for *MAJOR* refactorings.  That makes end-to-end tests much more attractive to me:  I&#8217;m likely to rip the guts out of the thing, changing its implementation radically.  So I want my automated regression tests to be remarkably ignorant of what&#8217;s going on in the middle layers &#8212; because it&#8217;s going to change.  ;-&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GeePawHill</title>
		<link>http://anarchycreek.com/2010/02/18/legacy-tdd-coach-not-knowing/comment-page-1/#comment-1006</link>
		<dc:creator>GeePawHill</dc:creator>
		<pubDate>Sun, 21 Feb 2010 03:11:35 +0000</pubDate>
		<guid isPermaLink="false">http://anarchycreek.com/?p=1128#comment-1006</guid>
		<description>Exactly. Industrial Logic also has online learning around this.

In java-land, E&amp;O is a universal, if ugly, solution. Others, like C++, would need a combo of techniques.

In general, even in Java, my third E&amp;O on the same class makes me cast about for alternatives, except in the most dire double-dawg-dare situation. :)

Seeya, Hill</description>
		<content:encoded><![CDATA[<p>Exactly. Industrial Logic also has online learning around this.</p>
<p>In java-land, E&#038;O is a universal, if ugly, solution. Others, like C++, would need a combo of techniques.</p>
<p>In general, even in Java, my third E&#038;O on the same class makes me cast about for alternatives, except in the most dire double-dawg-dare situation. <img src='http://anarchycreek.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Seeya, Hill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philip Schwarz</title>
		<link>http://anarchycreek.com/2010/02/18/legacy-tdd-coach-not-knowing/comment-page-1/#comment-1005</link>
		<dc:creator>Philip Schwarz</dc:creator>
		<pubDate>Sun, 21 Feb 2010 01:54:34 +0000</pubDate>
		<guid isPermaLink="false">http://anarchycreek.com/?p=1128#comment-1005</guid>
		<description>See &#039;Extract and Override Call&#039; in following chapter of &lt;a href=&quot;http://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052&quot; rel=&quot;nofollow&quot;&gt;Working Effectively with Legacy Code&lt;/a&gt;: &#039;Dependency Breaking Techniques&#039;</description>
		<content:encoded><![CDATA[<p>See &#8216;Extract and Override Call&#8217; in following chapter of <a href="http://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052" rel="nofollow">Working Effectively with Legacy Code</a>: &#8216;Dependency Breaking Techniques&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GeePawHill</title>
		<link>http://anarchycreek.com/2010/02/18/legacy-tdd-coach-not-knowing/comment-page-1/#comment-1004</link>
		<dc:creator>GeePawHill</dc:creator>
		<pubDate>Fri, 19 Feb 2010 22:37:37 +0000</pubDate>
		<guid isPermaLink="false">http://anarchycreek.com/?p=1128#comment-1004</guid>
		<description>Jeff, I don&#039;t test end-to-end much. I sometimes *do* write tests that are bigger than micros, but not even that, a lot.
Microtests don&#039;t catch every conceivable defect. They work well because they catch a *lot* of defects at a ridiculously cheap price (once the skill is learned).
As for the Feature Envy, you&#039;re probably right that that&#039;s what we got going on. The solutions could vary a lot, it would depend for me on all that code I pointed at with //... :)
Also, as you know, I advocate lots and lots of small refactorings before I tackle anything large, especially in a language like Java with it&#039;s awesome tool support.
Seeya!
Hill</description>
		<content:encoded><![CDATA[<p>Jeff, I don&#8217;t test end-to-end much. I sometimes *do* write tests that are bigger than micros, but not even that, a lot.<br />
Microtests don&#8217;t catch every conceivable defect. They work well because they catch a *lot* of defects at a ridiculously cheap price (once the skill is learned).<br />
As for the Feature Envy, you&#8217;re probably right that that&#8217;s what we got going on. The solutions could vary a lot, it would depend for me on all that code I pointed at with //&#8230; <img src='http://anarchycreek.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Also, as you know, I advocate lots and lots of small refactorings before I tackle anything large, especially in a language like Java with it&#8217;s awesome tool support.<br />
Seeya!<br />
Hill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GeePawHill</title>
		<link>http://anarchycreek.com/2010/02/18/legacy-tdd-coach-not-knowing/comment-page-1/#comment-1003</link>
		<dc:creator>GeePawHill</dc:creator>
		<pubDate>Fri, 19 Feb 2010 22:31:05 +0000</pubDate>
		<guid isPermaLink="false">http://anarchycreek.com/?p=1128#comment-1003</guid>
		<description>Cory, you&#039;re right. That noise can pile on so heavily that you find yourself ctrl-clicking half the source base just trying to hold the call stack in your head.
Most source files, come down to it, can be brought under microtest with the most cursory glance at their dependents. This is a direct result of knowing that microtests test a class ASSUMING ALL OTHER CLASSES WORK.</description>
		<content:encoded><![CDATA[<p>Cory, you&#8217;re right. That noise can pile on so heavily that you find yourself ctrl-clicking half the source base just trying to hold the call stack in your head.<br />
Most source files, come down to it, can be brought under microtest with the most cursory glance at their dependents. This is a direct result of knowing that microtests test a class ASSUMING ALL OTHER CLASSES WORK.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GeePawHill</title>
		<link>http://anarchycreek.com/2010/02/18/legacy-tdd-coach-not-knowing/comment-page-1/#comment-1002</link>
		<dc:creator>GeePawHill</dc:creator>
		<pubDate>Fri, 19 Feb 2010 22:25:38 +0000</pubDate>
		<guid isPermaLink="false">http://anarchycreek.com/?p=1128#comment-1002</guid>
		<description>Raul...
In Java, Extract &amp; Override, where I extract the static call to a protected method and override it during testing is usually my first line of offense: E&amp;O solves every microtesting problem in Java, ultimately. 

Sometimes, tho, you do E&amp;O so many times it feels like you&#039;re testing swiss cheese. Then I will often create a class and assign it as a member during construction, then gradually teach that member to either call the static for me, or to implement the code itself. This is especially handy when there are lots of calls into the static, or when the static is just a global in disguise and is riddled through the code.

I&#039;m sure the other guys here have more ideas on this, too.

Seeya!
Hill</description>
		<content:encoded><![CDATA[<p>Raul&#8230;<br />
In Java, Extract &#038; Override, where I extract the static call to a protected method and override it during testing is usually my first line of offense: E&#038;O solves every microtesting problem in Java, ultimately. </p>
<p>Sometimes, tho, you do E&#038;O so many times it feels like you&#8217;re testing swiss cheese. Then I will often create a class and assign it as a member during construction, then gradually teach that member to either call the static for me, or to implement the code itself. This is especially handy when there are lots of calls into the static, or when the static is just a global in disguise and is riddled through the code.</p>
<p>I&#8217;m sure the other guys here have more ideas on this, too.</p>
<p>Seeya!<br />
Hill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Grigg</title>
		<link>http://anarchycreek.com/2010/02/18/legacy-tdd-coach-not-knowing/comment-page-1/#comment-1001</link>
		<dc:creator>Jeff Grigg</dc:creator>
		<pubDate>Fri, 19 Feb 2010 16:51:42 +0000</pubDate>
		<guid isPermaLink="false">http://anarchycreek.com/?p=1128#comment-1001</guid>
		<description>Gotta give the team credit for expressive class names that communicate well!   &gt;;-&gt;

Looks and sounds like the “DoSomethingMessy” method suffers from the “Feature Envy” code smell:  Given that lots of the code in the “DoSomethingMessy” method references values in the “MessyThing” class, this suggests that this code should be moved to (typically new) methods in the “MessyThing” class.

You’re right that you don’t need to know anything about the “Frustrator.staticMethod()” implementation to be able to do all the unit testing of the “DoSomethingMessy” method that you might want to do.  But I’m not such a big fan of limiting myself to just unit testing.  “End to end is further than you think.” is one of my favorite XP quotes.  So I’m inclined to dive into Frustrator, AnnoyMatic, StinkingInconvenient, and GoodLordThisIsReallyStupid, looking for a good point to forcefully inject a mocking layer.  “GoodLordThisIsReallyStupid” sounds, off hand, like something richly deserving of mocking.  (…on more than one level!!!   ;-)

(Maybe we should address raul’s static hack question.  I like to inject a weakly-Singleton concrete implementation of an Abstract Factory class at that point…  Singleton in the production code, but substituted with an alternative mock implementation while testing.)</description>
		<content:encoded><![CDATA[<p>Gotta give the team credit for expressive class names that communicate well!   &gt;;-&gt;</p>
<p>Looks and sounds like the “DoSomethingMessy” method suffers from the “Feature Envy” code smell:  Given that lots of the code in the “DoSomethingMessy” method references values in the “MessyThing” class, this suggests that this code should be moved to (typically new) methods in the “MessyThing” class.</p>
<p>You’re right that you don’t need to know anything about the “Frustrator.staticMethod()” implementation to be able to do all the unit testing of the “DoSomethingMessy” method that you might want to do.  But I’m not such a big fan of limiting myself to just unit testing.  “End to end is further than you think.” is one of my favorite XP quotes.  So I’m inclined to dive into Frustrator, AnnoyMatic, StinkingInconvenient, and GoodLordThisIsReallyStupid, looking for a good point to forcefully inject a mocking layer.  “GoodLordThisIsReallyStupid” sounds, off hand, like something richly deserving of mocking.  (…on more than one level!!!   <img src='http://anarchycreek.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>(Maybe we should address raul’s static hack question.  I like to inject a weakly-Singleton concrete implementation of an Abstract Factory class at that point…  Singleton in the production code, but substituted with an alternative mock implementation while testing.)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

