<?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: Dynamic Languages are not Inherently More Testable</title>
	<atom:link href="http://misko.hevery.com/2008/07/13/dynamic-languages-are-not-more-testable/feed/" rel="self" type="application/rss+xml" />
	<link>http://misko.hevery.com/2008/07/13/dynamic-languages-are-not-more-testable/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dynamic-languages-are-not-more-testable</link>
	<description>Testability Explorer</description>
	<lastBuildDate>Fri, 28 Jun 2013 07:36:19 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.2</generator>
	<item>
		<title>By: fcamel&#8217;s blog &#187; 最近用 Python + TDD 心得（與 Java 做對照）</title>
		<link>http://misko.hevery.com/2008/07/13/dynamic-languages-are-not-more-testable/comment-page-1/#comment-3634</link>
		<dc:creator>fcamel&#8217;s blog &#187; 最近用 Python + TDD 心得（與 Java 做對照）</dc:creator>
		<pubDate>Wed, 16 Jun 2010 02:24:37 +0000</pubDate>
		<guid isPermaLink="false">http://s90424825.onlinehome.us/blog/?p=46#comment-3634</guid>
		<description><![CDATA[[...] Python 並不會因為方便抽換既有物件而較好測試, 《Dynamic Languages are not Inherently More Testable》提到這樣當於更動 global object, glob... [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Python 並不會因為方便抽換既有物件而較好測試, 《Dynamic Languages are not Inherently More Testable》提到這樣當於更動 global object, glob&#8230; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JRiddy</title>
		<link>http://misko.hevery.com/2008/07/13/dynamic-languages-are-not-more-testable/comment-page-1/#comment-2277</link>
		<dc:creator>JRiddy</dc:creator>
		<pubDate>Thu, 05 Nov 2009 22:34:36 +0000</pubDate>
		<guid isPermaLink="false">http://s90424825.onlinehome.us/blog/?p=46#comment-2277</guid>
		<description><![CDATA[I think the advantage in testability in &quot;dynamic languages&quot; comes from being able to use a REPL or interactive shell. This, combined with good design principles, either OO or functional and referential-transpancy, allows you to test what you have written right after you have written it. Not only does this encourage keeping your functional units small because larger units are harder to test, it&#039;s just more satisfying to work with. You get the satisfaction of completing a function just as soon as you wrote it.

Your point about changing global methods is totally valid, and experienced users of dynamic languages often frown on too much of this practice. I learned this the ugly way when I inherited code from a JavaScript programmer who wrote tons of methods into Object.prototype (*gasp*). However, judicious use of prototypes in JS or things like open classes in Ruby can yield extremely positive results that make life much easier for everyone. I mean, c&#039;mon, doesn&#039;t every Java programmer in the world want a string method that matches against a regex already?]]></description>
		<content:encoded><![CDATA[<p>I think the advantage in testability in &#8220;dynamic languages&#8221; comes from being able to use a REPL or interactive shell. This, combined with good design principles, either OO or functional and referential-transpancy, allows you to test what you have written right after you have written it. Not only does this encourage keeping your functional units small because larger units are harder to test, it&#8217;s just more satisfying to work with. You get the satisfaction of completing a function just as soon as you wrote it.</p>
<p>Your point about changing global methods is totally valid, and experienced users of dynamic languages often frown on too much of this practice. I learned this the ugly way when I inherited code from a JavaScript programmer who wrote tons of methods into Object.prototype (*gasp*). However, judicious use of prototypes in JS or things like open classes in Ruby can yield extremely positive results that make life much easier for everyone. I mean, c&#8217;mon, doesn&#8217;t every Java programmer in the world want a string method that matches against a regex already?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paddy3118</title>
		<link>http://misko.hevery.com/2008/07/13/dynamic-languages-are-not-more-testable/comment-page-1/#comment-717</link>
		<dc:creator>Paddy3118</dc:creator>
		<pubDate>Sat, 21 Feb 2009 18:05:41 +0000</pubDate>
		<guid isPermaLink="false">http://s90424825.onlinehome.us/blog/?p=46#comment-717</guid>
		<description><![CDATA[The supporters of Lisp and its ilk maintain that code being data, and just as mutable as data is a *good* thing. I&#039;ve programmed in a Lisp-like language with this property and found it to be liberating in some respects to. Dynamic languages like Python and Ruby are not as dynamic as Lisp in the code==data area, but approach the same flexibility.It would be a shame if, rather than try and explore what dynamism brings and generating best practices that suite dynamic development  and testing, we instead ran scared and forced what seemed best for development in static languages on them.The software industry generates a lot of very expensive junk and most of that seems to be written in static languages. Maybe exposure to dynamic languahes can be a kick up the backside that leads to better results because if OO on Java is the best we have now, customers will stop paying.- Paddy.]]></description>
		<content:encoded><![CDATA[<p>The supporters of Lisp and its ilk maintain that code being data, and just as mutable as data is a *good* thing. I&#8217;ve programmed in a Lisp-like language with this property and found it to be liberating in some respects to. Dynamic languages like Python and Ruby are not as dynamic as Lisp in the code==data area, but approach the same flexibility.It would be a shame if, rather than try and explore what dynamism brings and generating best practices that suite dynamic development  and testing, we instead ran scared and forced what seemed best for development in static languages on them.The software industry generates a lot of very expensive junk and most of that seems to be written in static languages. Maybe exposure to dynamic languahes can be a kick up the backside that leads to better results because if OO on Java is the best we have now, customers will stop paying.- Paddy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aristotle Pagaltzis</title>
		<link>http://misko.hevery.com/2008/07/13/dynamic-languages-are-not-more-testable/comment-page-1/#comment-453</link>
		<dc:creator>Aristotle Pagaltzis</dc:creator>
		<pubDate>Tue, 09 Dec 2008 09:23:19 +0000</pubDate>
		<guid isPermaLink="false">http://s90424825.onlinehome.us/blog/?p=46#comment-453</guid>
		<description><![CDATA[I think the importance of this argument is in dealing with legacy codebases. With dynamic languages, you have a variety of ways by which you can force tests into a system that was never designed for them, and thus gain confidence to refactor; with static languages, it is very much harder to unravel a big untestable codebase.

Of course, if you design for testability from the start, then this point is obviously moot. But that’s not the world everyone lives in… or is thrown into.]]></description>
		<content:encoded><![CDATA[<p>I think the importance of this argument is in dealing with legacy codebases. With dynamic languages, you have a variety of ways by which you can force tests into a system that was never designed for them, and thus gain confidence to refactor; with static languages, it is very much harder to unravel a big untestable codebase.</p>
<p>Of course, if you design for testability from the start, then this point is obviously moot. But that’s not the world everyone lives in… or is thrown into.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: misko</title>
		<link>http://misko.hevery.com/2008/07/13/dynamic-languages-are-not-more-testable/comment-page-1/#comment-142</link>
		<dc:creator>misko</dc:creator>
		<pubDate>Sat, 06 Sep 2008 17:30:31 +0000</pubDate>
		<guid isPermaLink="false">http://s90424825.onlinehome.us/blog/?p=46#comment-142</guid>
		<description><![CDATA[@Jonathan,

Great point about instance method overriding, and you are right there is no global state. However, instance method overriding is equivalent to overriding methods in tests in java using anonymous inner classes. Most TDD frown upon that. The other issues is more complex. If you mix object creation with application logic than you can instantiate the object under test and you can override instance method on the object. But if the object-under-test instantiates other objects you don&#039;t have a reference to those objects, and hence you can&#039;t override the instance methods there.

The main point I want to get to is that you can&#039;t leave testability as after the fact. Testability is something you have to bake into the design of your application. You have to think about it from day one.  Now, it is true that there are more tricks you can use to tests your application in dynamic languages, but I feel that those tricks are all work around to the core problem of untestable design. But it differently, you can&#039;t not think about testing in dynamic languages.

The other important point is that testing should be done by wiring objects in tests differently than in production. By replacing key objects with test-doubles your test graph of objects can be controlled. Dynamic languages allow you to change code at runtime, but now you are testing by modifying code rather than wiring the code differently. Since you are modifying code it is very easy to get lost as to what is real and what is replaced code. You no longer have clear separation of objects.

I think what is true is this: In dynamic languages you can write tests for badly designed code, something which is very hard to do in Static languages. However, the tests you write will be brittle and will rely on global state. Claiming that it is more testable is simply missing the point that testability is something which needs to be baked into the codebase.]]></description>
		<content:encoded><![CDATA[<p>@Jonathan,</p>
<p>Great point about instance method overriding, and you are right there is no global state. However, instance method overriding is equivalent to overriding methods in tests in java using anonymous inner classes. Most TDD frown upon that. The other issues is more complex. If you mix object creation with application logic than you can instantiate the object under test and you can override instance method on the object. But if the object-under-test instantiates other objects you don&#8217;t have a reference to those objects, and hence you can&#8217;t override the instance methods there.</p>
<p>The main point I want to get to is that you can&#8217;t leave testability as after the fact. Testability is something you have to bake into the design of your application. You have to think about it from day one.  Now, it is true that there are more tricks you can use to tests your application in dynamic languages, but I feel that those tricks are all work around to the core problem of untestable design. But it differently, you can&#8217;t not think about testing in dynamic languages.</p>
<p>The other important point is that testing should be done by wiring objects in tests differently than in production. By replacing key objects with test-doubles your test graph of objects can be controlled. Dynamic languages allow you to change code at runtime, but now you are testing by modifying code rather than wiring the code differently. Since you are modifying code it is very easy to get lost as to what is real and what is replaced code. You no longer have clear separation of objects.</p>
<p>I think what is true is this: In dynamic languages you can write tests for badly designed code, something which is very hard to do in Static languages. However, the tests you write will be brittle and will rely on global state. Claiming that it is more testable is simply missing the point that testability is something which needs to be baked into the codebase.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Hartley</title>
		<link>http://misko.hevery.com/2008/07/13/dynamic-languages-are-not-more-testable/comment-page-1/#comment-137</link>
		<dc:creator>Jonathan Hartley</dc:creator>
		<pubDate>Thu, 04 Sep 2008 09:59:27 +0000</pubDate>
		<guid isPermaLink="false">http://s90424825.onlinehome.us/blog/?p=46#comment-137</guid>
		<description><![CDATA[What do you think about replacing methods on an individual object?

This provides a useful extra seam that me and my colleagues use a lot during unit-testing, and it doesn&#039;t affect global state. The object in question will be out of scope by the end of the test, and a new one constructed for each subsequent test.]]></description>
		<content:encoded><![CDATA[<p>What do you think about replacing methods on an individual object?</p>
<p>This provides a useful extra seam that me and my colleagues use a lot during unit-testing, and it doesn&#8217;t affect global state. The object in question will be out of scope by the end of the test, and a new one constructed for each subsequent test.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
