<?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: Test-driven development with code generation</title>
	<atom:link href="http://www.noctovis.net/blog/index.php/2009/03/05/test-driven-development-with-code-generation/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.noctovis.net/blog/index.php/2009/03/05/test-driven-development-with-code-generation/</link>
	<description>A night's vision on .NET</description>
	<lastBuildDate>Sat, 17 Oct 2009 11:00:07 +0200</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: kilfour</title>
		<link>http://www.noctovis.net/blog/index.php/2009/03/05/test-driven-development-with-code-generation/comment-page-1/#comment-324</link>
		<dc:creator>kilfour</dc:creator>
		<pubDate>Wed, 11 Mar 2009 20:56:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.noctovis.net/blog/index.php/2009/03/05/test-driven-development-with-code-generation/#comment-324</guid>
		<description>@Jan
I think the point about code generation being &lt;i&gt;evil&lt;/i&gt; was clearly made in one of Davy Brion&#039;s posts and I fully agree with everything that was said there. Most of the time code generation is a hack.
However there is another way (using machine learning techniques). Google QuickCheck, or read a John Koza paper. Tricky, but not impossible, just a lot of work, to get it right in an imperative language. You really need stuff like an abstract syntax tree, and things like a state monad are very usefull indeed. Genetic algorithms f.i. can generate solutions much better than any deterministic solution for problems like diophantine equations, or the travelling salesman problem (the canonnical example of GA&#039;s). 
Even Ward Cunningham used code generation : http://www.neocoretechs.com/vision.html. Something I have implemented in dotnet myself with less than satisfactory results but still an interesting idea. Seeing how mr Ward didn&#039;t follow up on this I assume he also hit a wall. 
A working and very impressive example : QuickCheck.
It allows you to define invariants of your program as properties and it runs thousands of randomly generated tests checking these properties. Upon failure it reduces this to the simplest possible failure case and reports it. 
see : http://video.google.com/videoplay?docid=4655369445141008672.
Code generation is evil. That&#039;s the rule. But as the first xp-rule says : There are no rules.
On a side-note : Pex (although helpfull) doesn&#039;t seem to do the trick unfortunately. It&#039;s still just unit testing.</description>
		<content:encoded><![CDATA[<p>@Jan<br />
I think the point about code generation being <i>evil</i> was clearly made in one of Davy Brion&#8217;s posts and I fully agree with everything that was said there. Most of the time code generation is a hack.<br />
However there is another way (using machine learning techniques). Google QuickCheck, or read a John Koza paper. Tricky, but not impossible, just a lot of work, to get it right in an imperative language. You really need stuff like an abstract syntax tree, and things like a state monad are very usefull indeed. Genetic algorithms f.i. can generate solutions much better than any deterministic solution for problems like diophantine equations, or the travelling salesman problem (the canonnical example of GA&#8217;s).<br />
Even Ward Cunningham used code generation : <a href="http://www.neocoretechs.com/vision.html" rel="nofollow">http://www.neocoretechs.com/vision.html</a>. Something I have implemented in dotnet myself with less than satisfactory results but still an interesting idea. Seeing how mr Ward didn&#8217;t follow up on this I assume he also hit a wall.<br />
A working and very impressive example : QuickCheck.<br />
It allows you to define invariants of your program as properties and it runs thousands of randomly generated tests checking these properties. Upon failure it reduces this to the simplest possible failure case and reports it.<br />
see : <a href="http://video.google.com/videoplay?docid=4655369445141008672" rel="nofollow">http://video.google.com/videoplay?docid=4655369445141008672</a>.<br />
Code generation is evil. That&#8217;s the rule. But as the first xp-rule says : There are no rules.<br />
On a side-note : Pex (although helpfull) doesn&#8217;t seem to do the trick unfortunately. It&#8217;s still just unit testing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan Van Ryswyck</title>
		<link>http://www.noctovis.net/blog/index.php/2009/03/05/test-driven-development-with-code-generation/comment-page-1/#comment-323</link>
		<dc:creator>Jan Van Ryswyck</dc:creator>
		<pubDate>Wed, 11 Mar 2009 20:03:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.noctovis.net/blog/index.php/2009/03/05/test-driven-development-with-code-generation/#comment-323</guid>
		<description>Test generation (like any form kind of code generation) completely misses the point. This has nothing to do with TDD or BDD, but everything with just testing your code. TDD and certainly BDD is writing a valuable test driven by requirements before any production code is written to satisfy that test. Its not that using NUnit, xUnit, etc. is the same as TDD ord BDD. These are design activities. That&#039;s what Kent Beck is referring to. 

Generating production code with some half baked &#039;integration tests&#039; has nothing to do with designing soluble code. Code generation makes you instantly productive but brings a lot of suffering as the project evolves and the code needs maintenance. Its like shooting yourself in the foot while completely drugged by morphine. You won&#039;t feel the pain immediately, but it will get there.

I&#039;ve been ranting about code generation in the past (http://vanryswyckjan.blogspot.com/2008/02/on-software-factories.html), although I think I didn&#039;t make myself entirely clear. Generating test code is even worse than generating production code in my book.

Sorry for the long rant, but code generation keeps pissing me off.</description>
		<content:encoded><![CDATA[<p>Test generation (like any form kind of code generation) completely misses the point. This has nothing to do with TDD or BDD, but everything with just testing your code. TDD and certainly BDD is writing a valuable test driven by requirements before any production code is written to satisfy that test. Its not that using NUnit, xUnit, etc. is the same as TDD ord BDD. These are design activities. That&#8217;s what Kent Beck is referring to. </p>
<p>Generating production code with some half baked &#8216;integration tests&#8217; has nothing to do with designing soluble code. Code generation makes you instantly productive but brings a lot of suffering as the project evolves and the code needs maintenance. Its like shooting yourself in the foot while completely drugged by morphine. You won&#8217;t feel the pain immediately, but it will get there.</p>
<p>I&#8217;ve been ranting about code generation in the past (<a href="http://vanryswyckjan.blogspot.com/2008/02/on-software-factories.html)" rel="nofollow">http://vanryswyckjan.blogspot.com/2008/02/on-software-factories.html)</a>, although I think I didn&#8217;t make myself entirely clear. Generating test code is even worse than generating production code in my book.</p>
<p>Sorry for the long rant, but code generation keeps pissing me off.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kilfour</title>
		<link>http://www.noctovis.net/blog/index.php/2009/03/05/test-driven-development-with-code-generation/comment-page-1/#comment-319</link>
		<dc:creator>kilfour</dc:creator>
		<pubDate>Wed, 11 Mar 2009 10:36:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.noctovis.net/blog/index.php/2009/03/05/test-driven-development-with-code-generation/#comment-319</guid>
		<description>I think there&#039;s a big difference between Pex and the testsuite described above. Pex actually generates &lt;i&gt;smart tests&lt;/i&gt; (property-based checking). The tests described in this post are just stubs, and in my opinion useless noise. The judges aren&#039;t in yet on the usefullness of Pex ( it only works out of the box for VS2008 and my current project uses VS2005, too many toys, too litle time ;-) ), but I have been using QuickCheck in Haskell (along with HUnit) with extremely satisfactory results.</description>
		<content:encoded><![CDATA[<p>I think there&#8217;s a big difference between Pex and the testsuite described above. Pex actually generates <i>smart tests</i> (property-based checking). The tests described in this post are just stubs, and in my opinion useless noise. The judges aren&#8217;t in yet on the usefullness of Pex ( it only works out of the box for VS2008 and my current project uses VS2005, too many toys, too litle time <img src='http://www.noctovis.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ), but I have been using QuickCheck in Haskell (along with HUnit) with extremely satisfactory results.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nathan</title>
		<link>http://www.noctovis.net/blog/index.php/2009/03/05/test-driven-development-with-code-generation/comment-page-1/#comment-301</link>
		<dc:creator>Nathan</dc:creator>
		<pubDate>Mon, 09 Mar 2009 12:40:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.noctovis.net/blog/index.php/2009/03/05/test-driven-development-with-code-generation/#comment-301</guid>
		<description>I saw a presentation on Microsoft &quot;Pex&quot; this weekend at Roanoke Code Camp and I found myself thinking something very similar.  All the generated tests do is validate your code, bugs and all. This will lead to a generation of &quot;programmers&quot; who&#039;s only exposure to unit tests is relying on tools to auto-generate their tests to validate their buggy code.  100% code coverate FTW.</description>
		<content:encoded><![CDATA[<p>I saw a presentation on Microsoft &#8220;Pex&#8221; this weekend at Roanoke Code Camp and I found myself thinking something very similar.  All the generated tests do is validate your code, bugs and all. This will lead to a generation of &#8220;programmers&#8221; who&#8217;s only exposure to unit tests is relying on tools to auto-generate their tests to validate their buggy code.  100% code coverate FTW.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DotNetShoutout</title>
		<link>http://www.noctovis.net/blog/index.php/2009/03/05/test-driven-development-with-code-generation/comment-page-1/#comment-277</link>
		<dc:creator>DotNetShoutout</dc:creator>
		<pubDate>Sat, 07 Mar 2009 16:30:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.noctovis.net/blog/index.php/2009/03/05/test-driven-development-with-code-generation/#comment-277</guid>
		<description>&lt;strong&gt;Test-driven development with code generation - Nocturn vision...&lt;/strong&gt;

Thank you for submitting this cool story - Trackback from DotNetShoutout...</description>
		<content:encoded><![CDATA[<p><strong>Test-driven development with code generation &#8211; Nocturn vision&#8230;</strong></p>
<p>Thank you for submitting this cool story &#8211; Trackback from DotNetShoutout&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The Inquisitive Coder - Davy Brion&#8217;s Blog &#187; Blog Archive &#187; Smarten Up Instead Of Generating Dumb Tests</title>
		<link>http://www.noctovis.net/blog/index.php/2009/03/05/test-driven-development-with-code-generation/comment-page-1/#comment-253</link>
		<dc:creator>The Inquisitive Coder - Davy Brion&#8217;s Blog &#187; Blog Archive &#187; Smarten Up Instead Of Generating Dumb Tests</dc:creator>
		<pubDate>Thu, 05 Mar 2009 22:58:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.noctovis.net/blog/index.php/2009/03/05/test-driven-development-with-code-generation/#comment-253</guid>
		<description>[...] has a post about a code generation process which generates tests:  Since the generated code is fully [...]</description>
		<content:encoded><![CDATA[<p>[...] has a post about a code generation process which generates tests:  Since the generated code is fully [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
