<?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: Book Review of &#8220;The ThoughtWorks Anthology: Essays on Software Technology and Innovation&#8221;</title>
	<atom:link href="http://codemonkeyism.com/review-of-the-thoughtworks-anthology-essays-on-software-technology/feed/" rel="self" type="application/rss+xml" />
	<link>http://codemonkeyism.com/review-of-the-thoughtworks-anthology-essays-on-software-technology/</link>
	<description></description>
	<lastBuildDate>Thu, 11 Mar 2010 23:38:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Dave</title>
		<link>http://codemonkeyism.com/review-of-the-thoughtworks-anthology-essays-on-software-technology/comment-page-1/#comment-240088</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Thu, 20 Aug 2009 17:29:53 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/04/25/review-of-the-thoughtworks-anthology-essays-on-software-technology/#comment-240088</guid>
		<description>That last &quot;isEmpty&quot; (OMG indeed) has the problem of creating an extra String object unnecessarily if the string is already trimmed.

Better:

public boolean isEmpty(String val)
{
   return val == null &#124;&#124; val.length() == 0 &#124;&#124; val.trim().length() == 0;
}</description>
		<content:encoded><![CDATA[<p>That last &#8220;isEmpty&#8221; (OMG indeed) has the problem of creating an extra String object unnecessarily if the string is already trimmed.</p>
<p>Better:</p>
<p>public boolean isEmpty(String val)<br />
{<br />
   return val == null || val.length() == 0 || val.trim().length() == 0;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raman</title>
		<link>http://codemonkeyism.com/review-of-the-thoughtworks-anthology-essays-on-software-technology/comment-page-1/#comment-238706</link>
		<dc:creator>Raman</dc:creator>
		<pubDate>Mon, 10 Aug 2009 13:59:03 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/04/25/review-of-the-thoughtworks-anthology-essays-on-software-technology/#comment-238706</guid>
		<description>OMG!

public boolean isEmpty(String value) {
   return value == null &#124;&#124; value.trim().length() == 0;
}

(Or use isEmpty if ur string is not null and u under java 6).</description>
		<content:encoded><![CDATA[<p>OMG!</p>
<p>public boolean isEmpty(String value) {<br />
   return value == null || value.trim().length() == 0;<br />
}</p>
<p>(Or use isEmpty if ur string is not null and u under java 6).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: basic pooker instructions</title>
		<link>http://codemonkeyism.com/review-of-the-thoughtworks-anthology-essays-on-software-technology/comment-page-1/#comment-161501</link>
		<dc:creator>basic pooker instructions</dc:creator>
		<pubDate>Thu, 04 Sep 2008 14:58:51 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/04/25/review-of-the-thoughtworks-anthology-essays-on-software-technology/#comment-161501</guid>
		<description>&lt;strong&gt;basic pooker instructions...&lt;/strong&gt;

shielded:gasser circumvented!purports:overwriting!esteemed:...</description>
		<content:encoded><![CDATA[<p><strong>basic pooker instructions&#8230;</strong></p>
<p>shielded:gasser circumvented!purports:overwriting!esteemed:&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lowell</title>
		<link>http://codemonkeyism.com/review-of-the-thoughtworks-anthology-essays-on-software-technology/comment-page-1/#comment-84834</link>
		<dc:creator>Lowell</dc:creator>
		<pubDate>Mon, 05 May 2008 01:32:13 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/04/25/review-of-the-thoughtworks-anthology-essays-on-software-technology/#comment-84834</guid>
		<description>If you are using Java 6, there is a new method: String.isEmpty(). You could use that in your Java example and then you wouldn&#039;t need to write your own.</description>
		<content:encoded><![CDATA[<p>If you are using Java 6, there is a new method: String.isEmpty(). You could use that in your Java example and then you wouldn&#8217;t need to write your own.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/review-of-the-thoughtworks-anthology-essays-on-software-technology/comment-page-1/#comment-81201</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Mon, 28 Apr 2008 04:53:14 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/04/25/review-of-the-thoughtworks-anthology-essays-on-software-technology/#comment-81201</guid>
		<description>I took a look at &lt;code&gt;new String()&lt;/code&gt;, they do a array copy, perhaps because otherwise a larger String from which a substring was created could not be reclaimed by GC.</description>
		<content:encoded><![CDATA[<p>I took a look at <code>new String()</code>, they do a array copy, perhaps because otherwise a larger String from which a substring was created could not be reclaimed by GC.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/review-of-the-thoughtworks-anthology-essays-on-software-technology/comment-page-1/#comment-81197</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Mon, 28 Apr 2008 04:16:41 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/04/25/review-of-the-thoughtworks-anthology-essays-on-software-technology/#comment-81197</guid>
		<description>Thanks for looking, it does create a new String. What I meant was that it would create a new String object but do not copy and use a new character array but reuse the old one, just with different pointers to beginning and end. Because String is immutable this would work.</description>
		<content:encoded><![CDATA[<p>Thanks for looking, it does create a new String. What I meant was that it would create a new String object but do not copy and use a new character array but reuse the old one, just with different pointers to beginning and end. Because String is immutable this would work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lumpynose</title>
		<link>http://codemonkeyism.com/review-of-the-thoughtworks-anthology-essays-on-software-technology/comment-page-1/#comment-81182</link>
		<dc:creator>lumpynose</dc:creator>
		<pubDate>Mon, 28 Apr 2008 03:12:40 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/04/25/review-of-the-thoughtworks-anthology-essays-on-software-technology/#comment-81182</guid>
		<description>&quot;trim() probably does not create a new String in Java&quot; is that a typo?  Since Strings are immutable I&#039;d think that the obvious conclusion is that it would have to create a new String.

And if you look at the source, trim() calls substring(), which ends with

[pre]
	return ((beginIndex == 0) &amp;&amp; (endIndex == count)) ? this :
	    new String(offset   beginIndex, endIndex - beginIndex, value);
[/pre]</description>
		<content:encoded><![CDATA[<p>&#8220;trim() probably does not create a new String in Java&#8221; is that a typo?  Since Strings are immutable I&#8217;d think that the obvious conclusion is that it would have to create a new String.</p>
<p>And if you look at the source, trim() calls substring(), which ends with</p>
<p>[pre]<br />
	return ((beginIndex == 0) &amp;&amp; (endIndex == count)) ? this :<br />
	    new String(offset   beginIndex, endIndex &#8211; beginIndex, value);<br />
[/pre]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/review-of-the-thoughtworks-anthology-essays-on-software-technology/comment-page-1/#comment-80915</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Sun, 27 Apr 2008 18:13:39 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/04/25/review-of-the-thoughtworks-anthology-essays-on-software-technology/#comment-80915</guid>
		<description>Yes, as I&#039;ve wrote:

&quot;(which has other performance and memory characteristics).&quot;

&lt;code&gt;trim()&lt;/code&gt; probably does not create a new String in Java, because Strings are immutable (I know Reflection yaddayadda).</description>
		<content:encoded><![CDATA[<p>Yes, as I&#8217;ve wrote:</p>
<p>&#8220;(which has other performance and memory characteristics).&#8221;</p>
<p><code>trim()</code> probably does not create a new String in Java, because Strings are immutable (I know Reflection yaddayadda).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lumpynose</title>
		<link>http://codemonkeyism.com/review-of-the-thoughtworks-anthology-essays-on-software-technology/comment-page-1/#comment-80914</link>
		<dc:creator>lumpynose</dc:creator>
		<pubDate>Sun, 27 Apr 2008 18:11:08 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/04/25/review-of-the-thoughtworks-anthology-essays-on-software-technology/#comment-80914</guid>
		<description>To add to what vr said, another thing to think about is that Commons Lang isblank() is a library routine which is probably used a lot; I use it all the time.  Its code is clean, simple, and straightforward so it will be easy to maintain.  It may not be &quot;pretty&quot; from the perspective of a Ruby programmer, but like vr says, it&#039;s maximally efficient.

Speed is still a significant issue with Ruby, perhaps because there is too much &quot;pretty&quot; Ruby code that&#039;s inefficient.</description>
		<content:encoded><![CDATA[<p>To add to what vr said, another thing to think about is that Commons Lang isblank() is a library routine which is probably used a lot; I use it all the time.  Its code is clean, simple, and straightforward so it will be easy to maintain.  It may not be &#8220;pretty&#8221; from the perspective of a Ruby programmer, but like vr says, it&#8217;s maximally efficient.</p>
<p>Speed is still a significant issue with Ruby, perhaps because there is too much &#8220;pretty&#8221; Ruby code that&#8217;s inefficient.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/review-of-the-thoughtworks-anthology-essays-on-software-technology/comment-page-1/#comment-80600</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Sat, 26 Apr 2008 23:59:10 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/04/25/review-of-the-thoughtworks-anthology-essays-on-software-technology/#comment-80600</guid>
		<description>As I&#039;ve wrote &lt;i&gt;(which has other performance and memory characteristics)&lt;/i&gt;.

&quot;[...] results in creation of a new String object,  [...]&quot;

I know, see above.

&quot;[...] , is more efficient [...]&quot;

I know, see above.</description>
		<content:encoded><![CDATA[<p>As I&#8217;ve wrote <i>(which has other performance and memory characteristics)</i>.</p>
<p>&#8220;[...] results in creation of a new String object,  [...]&#8221;</p>
<p>I know, see above.</p>
<p>&#8220;[...] , is more efficient [...]&#8221;</p>
<p>I know, see above.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vr</title>
		<link>http://codemonkeyism.com/review-of-the-thoughtworks-anthology-essays-on-software-technology/comment-page-1/#comment-80594</link>
		<dc:creator>vr</dc:creator>
		<pubDate>Sat, 26 Apr 2008 23:43:06 +0000</pubDate>
		<guid isPermaLink="false">http://stephan.reposita.org/archives/2008/04/25/review-of-the-thoughtworks-anthology-essays-on-software-technology/#comment-80594</guid>
		<description>I would not be as quick to brand isBlank() as an example of bad code. It&#039;s a static utility method and it is only required to do what it is asked for, but with a maximum possible efficiency. Indeed, the for-loop would look a bit ugly to a stranger, but strangers don&#039;t look inside the code, they would just use it, unless they have the urge to criticize or a sudden curiosity attack. 

See, your suggested &quot;substitute&quot; calls String&#039;s trim, which (a) has TWO loops (to check from the beginning and the end of the String; (b) considers any symbol with a code lass than &#039;  &#039; to be a whitespace, which is not what isBlank() doing (it is more strict and sticks to Unicode definition of whitespace). Not only that, a call to your string.trim() results in creation of a new String object, which you&#039;re almost certainly not going to use (unless it _is_ blank and it gets cached by VM in the String pool). Think again: isBlank() does exactly what it was asked for, is more efficient and you don&#039;t have to think about all of the above, unless you&#039;re that wonderful essay author or just a reader with brain somewhat disturbed by essay&#039;s content.</description>
		<content:encoded><![CDATA[<p>I would not be as quick to brand isBlank() as an example of bad code. It&#8217;s a static utility method and it is only required to do what it is asked for, but with a maximum possible efficiency. Indeed, the for-loop would look a bit ugly to a stranger, but strangers don&#8217;t look inside the code, they would just use it, unless they have the urge to criticize or a sudden curiosity attack. </p>
<p>See, your suggested &#8220;substitute&#8221; calls String&#8217;s trim, which (a) has TWO loops (to check from the beginning and the end of the String; (b) considers any symbol with a code lass than &#8216;  &#8216; to be a whitespace, which is not what isBlank() doing (it is more strict and sticks to Unicode definition of whitespace). Not only that, a call to your string.trim() results in creation of a new String object, which you&#8217;re almost certainly not going to use (unless it _is_ blank and it gets cached by VM in the String pool). Think again: isBlank() does exactly what it was asked for, is more efficient and you don&#8217;t have to think about all of the above, unless you&#8217;re that wonderful essay author or just a reader with brain somewhat disturbed by essay&#8217;s content.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
