<?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: Escape from Zurg</title>
	<atom:link href="http://javablog.co.uk/2007/10/13/escape-from-zurg/feed/" rel="self" type="application/rss+xml" />
	<link>http://javablog.co.uk/2007/10/13/escape-from-zurg/</link>
	<description>by Java coders, for Java coders</description>
	<lastBuildDate>Thu, 22 Jul 2010 12:24:38 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: RIP Martin Gardner y el escape de Zurg &#8211; America Tecnología Informática</title>
		<link>http://javablog.co.uk/2007/10/13/escape-from-zurg/comment-page-1/#comment-96024</link>
		<dc:creator>RIP Martin Gardner y el escape de Zurg &#8211; America Tecnología Informática</dc:creator>
		<pubDate>Sun, 23 May 2010 03:31:10 +0000</pubDate>
		<guid isPermaLink="false">http://javablog.co.uk/2007/10/13/escape-from-zurg/#comment-96024</guid>
		<description>&lt;p&gt;[...] Revisando este blog encontré dicho puzzle. Vale la pena resolverlo mentalmente. Aquí la traducción: [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[&#8230;] Revisando este blog encontré dicho puzzle. Vale la pena resolverlo mentalmente. Aquí la traducción: [&#8230;]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Butcher</title>
		<link>http://javablog.co.uk/2007/10/13/escape-from-zurg/comment-page-1/#comment-1778</link>
		<dc:creator>Paul Butcher</dc:creator>
		<pubDate>Tue, 16 Oct 2007 09:39:00 +0000</pubDate>
		<guid isPermaLink="false">http://javablog.co.uk/2007/10/13/escape-from-zurg/#comment-1778</guid>
		<description>&lt;p&gt;So, as threatened, I&#039;ve written a blog post describing how equality works (as far as I understand it!) in Ruby:&lt;/p&gt;

&lt;p&gt;http://www.texperts.com/2007/10/16/navigating-the-equality-maze/&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>So, as threatened, I&#8217;ve written a blog post describing how equality works (as far as I understand it!) in Ruby:</p>

<p><a href="http://www.texperts.com/2007/10/16/navigating-the-equality-maze/" rel="nofollow">http://www.texperts.com/2007/10/16/navigating-the-equality-maze/</a></p>]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Butcher</title>
		<link>http://javablog.co.uk/2007/10/13/escape-from-zurg/comment-page-1/#comment-1747</link>
		<dc:creator>Paul Butcher</dc:creator>
		<pubDate>Sun, 14 Oct 2007 16:47:10 +0000</pubDate>
		<guid isPermaLink="false">http://javablog.co.uk/2007/10/13/escape-from-zurg/#comment-1747</guid>
		<description>&lt;p&gt;Regarding equal? versus == versus eql? think about it like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;equal?: object identity&lt;/li&gt;
&lt;li&gt;==: objects have the same meaning&lt;/li&gt;
&lt;li&gt;eql?: objects represent the same value&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So if you consider numbers:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# lang ruby
1 == 1.0
=&gt; true
1.eql? 1.0
=&gt; false
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This means that you can have a hash with a keys of both 1 and 1.0 (which wouldn&#039;t be true if hash used ==):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# lang ruby
h = {}
h[1] = &#039;an integer&#039;
h[1.0] = &#039;a float&#039;
h
=&gt; {1=&gt;&quot;an integer&quot;, 1.0=&gt;&quot;a float&quot;}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Regarding ===, this exists to enable some of the nice syntactic sugar that Ruby&#039;s case statement supports. For example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# lang ruby
(1..10) == 4
=&gt; false
(1..10) === 4
=&gt; true
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Which means that you can write this kind of thing:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# lang ruby
kind = case lines
  when 1..10: &quot;Short&quot;
  when 11..25: &quot;Medium&quot;
  when 26..50: &quot;Long&quot;
  else &quot;Too long!&quot;
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Regular expressions can play the same kind of trick:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# lang ruby
kind = case moment
  when /\d\d:\d\d:\d\d/: &#039;time&#039;
  when /\d\d\/\d\d\/\d\d/: &#039;date&#039;
  else &#039;other&#039;
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As can classes&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# lang ruby
case thing
  when String: # Handle strings here
  when Numeric: # Handle numbers here
  # etc...
end
&lt;/code&gt;&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<p>Regarding equal? versus == versus eql? think about it like this:</p>

<ul>
<li>equal?: object identity</li>
<li>==: objects have the same meaning</li>
<li>eql?: objects represent the same value</li>
</ul>

<p>So if you consider numbers:</p>

<pre class="highlighted"><code><span class="hl-number">1</span><span class="hl-code"> == </span><span class="hl-number">1.0</span><span class="hl-code">
=&gt; </span><span class="hl-reserved">true</span><span class="hl-code">
</span><span class="hl-number">1.</span><span class="hl-identifier">eql</span><span class="hl-code">? </span><span class="hl-number">1.0</span><span class="hl-code">
=&gt; </span><span class="hl-reserved">false</span></code></pre>

<p>This means that you can have a hash with a keys of both 1 and 1.0 (which wouldn&#8217;t be true if hash used ==):</p>

<pre class="highlighted"><code><span class="hl-identifier">h</span><span class="hl-code"> = {}
</span><span class="hl-identifier">h</span><span class="hl-brackets">[</span><span class="hl-number">1</span><span class="hl-brackets">]</span><span class="hl-code"> = </span><span class="hl-quotes">'</span><span class="hl-string">an integer</span><span class="hl-quotes">'</span><span class="hl-code">
</span><span class="hl-identifier">h</span><span class="hl-brackets">[</span><span class="hl-number">1.0</span><span class="hl-brackets">]</span><span class="hl-code"> = </span><span class="hl-quotes">'</span><span class="hl-string">a float</span><span class="hl-quotes">'</span><span class="hl-code">
</span><span class="hl-identifier">h</span><span class="hl-code">
=&gt; {</span><span class="hl-number">1</span><span class="hl-code">=&gt;</span><span class="hl-quotes">&quot;</span><span class="hl-string">an integer</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-number">1.0</span><span class="hl-code">=&gt;</span><span class="hl-quotes">&quot;</span><span class="hl-string">a float</span><span class="hl-quotes">&quot;</span><span class="hl-code">}</span></code></pre>

<p>Regarding ===, this exists to enable some of the nice syntactic sugar that Ruby&#8217;s case statement supports. For example:</p>

<pre class="highlighted"><code><span class="hl-brackets">(</span><span class="hl-number">1..10</span><span class="hl-brackets">)</span><span class="hl-code"> == </span><span class="hl-number">4</span><span class="hl-code">
=&gt; </span><span class="hl-reserved">false</span><span class="hl-code">
</span><span class="hl-brackets">(</span><span class="hl-number">1..10</span><span class="hl-brackets">)</span><span class="hl-code"> === </span><span class="hl-number">4</span><span class="hl-code">
=&gt; </span><span class="hl-reserved">true</span></code></pre>

<p>Which means that you can write this kind of thing:</p>

<pre class="highlighted"><code><span class="hl-identifier">kind</span><span class="hl-code"> = </span><span class="hl-reserved">case</span><span class="hl-code"> </span><span class="hl-identifier">lines</span><span class="hl-code">
  </span><span class="hl-reserved">when</span><span class="hl-code"> </span><span class="hl-number">1..10</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">Short</span><span class="hl-quotes">&quot;</span><span class="hl-code">
  </span><span class="hl-reserved">when</span><span class="hl-code"> </span><span class="hl-number">11..25</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">Medium</span><span class="hl-quotes">&quot;</span><span class="hl-code">
  </span><span class="hl-reserved">when</span><span class="hl-code"> </span><span class="hl-number">26..50</span><span class="hl-code">: </span><span class="hl-quotes">&quot;</span><span class="hl-string">Long</span><span class="hl-quotes">&quot;</span><span class="hl-code">
  </span><span class="hl-reserved">else</span><span class="hl-code"> </span><span class="hl-quotes">&quot;</span><span class="hl-string">Too long!</span><span class="hl-quotes">&quot;</span><span class="hl-code">
</span><span class="hl-reserved">end</span></code></pre>

<p>Regular expressions can play the same kind of trick:</p>

<pre class="highlighted"><code><span class="hl-identifier">kind</span><span class="hl-code"> = </span><span class="hl-reserved">case</span><span class="hl-code"> </span><span class="hl-identifier">moment</span><span class="hl-code">
  </span><span class="hl-reserved">when</span><span class="hl-quotes"> /</span><span class="hl-special">\d\d</span><span class="hl-string">:</span><span class="hl-special">\d\d</span><span class="hl-string">:</span><span class="hl-special">\d\d</span><span class="hl-quotes">/</span><span class="hl-code">: </span><span class="hl-quotes">'</span><span class="hl-string">time</span><span class="hl-quotes">'</span><span class="hl-code">
  </span><span class="hl-reserved">when</span><span class="hl-quotes"> /</span><span class="hl-special">\d\d\/\d\d\/\d\d</span><span class="hl-quotes">/</span><span class="hl-code">: </span><span class="hl-quotes">'</span><span class="hl-string">date</span><span class="hl-quotes">'</span><span class="hl-code">
  </span><span class="hl-reserved">else</span><span class="hl-code"> </span><span class="hl-quotes">'</span><span class="hl-string">other</span><span class="hl-quotes">'</span><span class="hl-code">
</span><span class="hl-reserved">end</span></code></pre>

<p>As can classes</p>

<pre class="highlighted"><code><span class="hl-reserved">case</span><span class="hl-code"> </span><span class="hl-identifier">thing</span><span class="hl-code">
  </span><span class="hl-reserved">when</span><span class="hl-code"> </span><span class="hl-identifier">String</span><span class="hl-code">: </span><span class="hl-comment"># Handle strings here</span><span class="hl-code">
  </span><span class="hl-reserved">when</span><span class="hl-code"> </span><span class="hl-identifier">Numeric</span><span class="hl-code">: </span><span class="hl-comment"># Handle numbers here</span><span class="hl-code">
  </span><span class="hl-comment"># etc...</span><span class="hl-code">
</span><span class="hl-reserved">end</span></code></pre>]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://javablog.co.uk/2007/10/13/escape-from-zurg/comment-page-1/#comment-1746</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Sun, 14 Oct 2007 14:56:40 +0000</pubDate>
		<guid isPermaLink="false">http://javablog.co.uk/2007/10/13/escape-from-zurg/#comment-1746</guid>
		<description>&lt;p&gt;Those operators sound similar to the Java ones... except &lt;code&gt;==&lt;/code&gt; and &lt;code&gt;equals&lt;/code&gt; are the other way round. There have been some requests in Java for a &lt;code&gt;===&lt;/code&gt; operator so that &lt;code&gt;a === b&lt;/code&gt; would be the same as &lt;code&gt;((a == b) &#124;&#124; ((a != null) &amp;&amp; a.equals(b)))&lt;/code&gt;. I&#039;m in favour of this, and it would certainly help to make the above generated code a lot cleaner! &lt;code&gt;null&lt;/code&gt; is a real pain in the ass.&lt;/p&gt;

&lt;p&gt;Java doesn&#039;t have special equality of switches or entry into hash tables... I don&#039;t really see why one would want to make these different.&lt;/p&gt;

&lt;p&gt;The spaceship operator doesn&#039;t have an equivalent operator in Java, but it seems the same as the &lt;code&gt;Comparable&lt;/code&gt; interface.&lt;/p&gt;

&lt;p&gt;Regex matching in Java is through the &lt;code&gt;Pattern&lt;/code&gt; and &lt;code&gt;Matcher&lt;/code&gt; classes. It&#039;s a bit more formal than the Ruby equivalents... the &lt;code&gt;String.matches()&lt;/code&gt; method is a convenience for simple regexes. I&#039;d also like to see more attention given to &lt;a href=&quot;http://forum.java.sun.com/thread.jspa?threadID=5215547&quot; rel=&quot;nofollow&quot;&gt;indexing of Strings for repeated searching&lt;/a&gt;, but nobody seems to have picked up on my post.&lt;/p&gt;

&lt;p&gt;Ruby is a very interesting language... the book I bought concentrated on comparing Rails to the insane J2EE frameworks out there. There were parts were I believe Java won hands down (Hibernate for persistence), and others where Ruby destroys Java (e.g. templating)... but as for the language itself, I was comparing it more with Python than Java. As a prototyping language, I&#039;d probably go with Python, but I&#039;m still interested enough in Ruby to continue learning it. The lack of IDE support is a pain, but that&#039;s probably because Eclipse has spoilt me these last few years.&lt;/p&gt;

&lt;p&gt;Things Java could learn from Ruby are:-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;limited subset of operator overriding (even C++ has this... come on Java!)&lt;/li&gt;
&lt;li&gt;shorthand notation for getter/setter variables&lt;/li&gt;
&lt;li&gt;the &lt;code&gt;int&lt;/code&gt;/&lt;code&gt;Integer&lt;/code&gt;/&lt;code&gt;BigInteger&lt;/code&gt; thing is a real pain in the butt. It would be amazing if this were transparently built into the language like in Ruby. The Haskell solution is even better... &lt;code&gt;Int&lt;/code&gt; is basically {&lt;code&gt;int&lt;/code&gt;, &lt;code&gt;Integer&lt;/code&gt;} and Integer is &lt;code&gt;BigInteger&lt;/code&gt;. However, that would break so much backwards compatibility it&#039;d have to be a new language; It has performance consequences and would break almost all native code out there.&lt;/li&gt;
&lt;/ul&gt;
</description>
		<content:encoded><![CDATA[<p>Those operators sound similar to the Java ones&#8230; except <code>==</code> and <code>equals</code> are the other way round. There have been some requests in Java for a <code>===</code> operator so that <code>a === b</code> would be the same as <code>((a == b) || ((a != null) &amp;&amp; a.equals(b)))</code>. I&#8217;m in favour of this, and it would certainly help to make the above generated code a lot cleaner! <code>null</code> is a real pain in the ass.</p>

<p>Java doesn&#8217;t have special equality of switches or entry into hash tables&#8230; I don&#8217;t really see why one would want to make these different.</p>

<p>The spaceship operator doesn&#8217;t have an equivalent operator in Java, but it seems the same as the <code>Comparable</code> interface.</p>

<p>Regex matching in Java is through the <code>Pattern</code> and <code>Matcher</code> classes. It&#8217;s a bit more formal than the Ruby equivalents&#8230; the <code>String.matches()</code> method is a convenience for simple regexes. I&#8217;d also like to see more attention given to <a href="http://forum.java.sun.com/thread.jspa?threadID=5215547" rel="nofollow">indexing of Strings for repeated searching</a>, but nobody seems to have picked up on my post.</p>

<p>Ruby is a very interesting language&#8230; the book I bought concentrated on comparing Rails to the insane J2EE frameworks out there. There were parts were I believe Java won hands down (Hibernate for persistence), and others where Ruby destroys Java (e.g. templating)&#8230; but as for the language itself, I was comparing it more with Python than Java. As a prototyping language, I&#8217;d probably go with Python, but I&#8217;m still interested enough in Ruby to continue learning it. The lack of IDE support is a pain, but that&#8217;s probably because Eclipse has spoilt me these last few years.</p>

<p>Things Java could learn from Ruby are:-</p>

<ul>
<li>limited subset of operator overriding (even C++ has this&#8230; come on Java!)</li>
<li>shorthand notation for getter/setter variables</li>
<li>the <code>int</code>/<code>Integer</code>/<code>BigInteger</code> thing is a real pain in the butt. It would be amazing if this were transparently built into the language like in Ruby. The Haskell solution is even better&#8230; <code>Int</code> is basically {<code>int</code>, <code>Integer</code>} and Integer is <code>BigInteger</code>. However, that would break so much backwards compatibility it&#8217;d have to be a new language; It has performance consequences and would break almost all native code out there.</li>
</ul>]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Butcher</title>
		<link>http://javablog.co.uk/2007/10/13/escape-from-zurg/comment-page-1/#comment-1745</link>
		<dc:creator>Paul Butcher</dc:creator>
		<pubDate>Sun, 14 Oct 2007 13:28:33 +0000</pubDate>
		<guid isPermaLink="false">http://javablog.co.uk/2007/10/13/escape-from-zurg/#comment-1745</guid>
		<description>&lt;p&gt;Equality (and comparisons in general) in Ruby are interesting. The simple answer to your question is that Ruby doesn&#039;t try to handle the problem for you. But putting it like that implies that the picture is simpler than it really is. I&#039;m not convinced that most Ruby developers (quite possibly including me) really understand the philosophy underlying Ruby&#039;s equality operators.&lt;/p&gt;

&lt;p&gt;Things are also different in Ruby because the philosophy underlying the type system (duck typing) is altogther from that underlying Java&#039;s. So I&#039;m not even sure that the same philosophical issue as the one you&#039;re worrying about really exists in Ruby.&lt;/p&gt;

&lt;p&gt;Ruby provides two &quot;core&quot; equality operators. Object#equals? and Object#==. Both of these can be overridden, and both by default just check for object identity.&lt;/p&gt;

&lt;p&gt;The difference is that the intention is that you &lt;em&gt;shouldn&#039;t&lt;/em&gt; override equals? (i.e. it should remain object identity), whereas the expectation is that == should implement &quot;natural&quot; equality, whatever that means in context. Most of Ruby&#039;s standard classes do override == (so, for example, Array#== returns true if both arrays contain the same number of elements and if each element is equal according to their own implementation of ==).&lt;/p&gt;

&lt;p&gt;So, basically, it&#039;s down to you to provide value semantics. The language doesn&#039;t try to do it for you. If you build your app mainly from standard classes, though, mostly it &quot;just works&quot; because they have done most of the work for you.&lt;/p&gt;

&lt;p&gt;It&#039;s complicated (or simplified, depending on how you look at it) by the fact that Ruby provides other comparison operators over and above equals? and ==, specifically:&lt;/p&gt;

&lt;p&gt;=== (case equality) which is used within case statements&lt;/p&gt;

&lt;p&gt;eql? which is used when inserting objects into hashes (so, overriding eql? implies that you should also override hash)&lt;/p&gt;

&lt;p&gt;&lt;=&gt; (the &quot;spaceship&quot; operator) which implements comparison for objects which support ordering.&lt;/p&gt;

&lt;p&gt;=~ which implements regular expression matching.&lt;/p&gt;

&lt;p&gt;Your question has prompted me to do a bit of searching to see if I can find a good discussion of the various different comparison operators in Ruby, and there doesn&#039;t really seem to be anything out there (although there is quite a bit of misinformation!). I may see if I can knock something together for our blog :-)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Equality (and comparisons in general) in Ruby are interesting. The simple answer to your question is that Ruby doesn&#8217;t try to handle the problem for you. But putting it like that implies that the picture is simpler than it really is. I&#8217;m not convinced that most Ruby developers (quite possibly including me) really understand the philosophy underlying Ruby&#8217;s equality operators.</p>

<p>Things are also different in Ruby because the philosophy underlying the type system (duck typing) is altogther from that underlying Java&#8217;s. So I&#8217;m not even sure that the same philosophical issue as the one you&#8217;re worrying about really exists in Ruby.</p>

<p>Ruby provides two &#8220;core&#8221; equality operators. Object#equals? and Object#==. Both of these can be overridden, and both by default just check for object identity.</p>

<p>The difference is that the intention is that you <em>shouldn&#8217;t</em> override equals? (i.e. it should remain object identity), whereas the expectation is that == should implement &#8220;natural&#8221; equality, whatever that means in context. Most of Ruby&#8217;s standard classes do override == (so, for example, Array#== returns true if both arrays contain the same number of elements and if each element is equal according to their own implementation of ==).</p>

<p>So, basically, it&#8217;s down to you to provide value semantics. The language doesn&#8217;t try to do it for you. If you build your app mainly from standard classes, though, mostly it &#8220;just works&#8221; because they have done most of the work for you.</p>

<p>It&#8217;s complicated (or simplified, depending on how you look at it) by the fact that Ruby provides other comparison operators over and above equals? and ==, specifically:</p>

<p>=== (case equality) which is used within case statements</p>

<p>eql? which is used when inserting objects into hashes (so, overriding eql? implies that you should also override hash)</p>

<p>&lt;=&gt; (the &#8220;spaceship&#8221; operator) which implements comparison for objects which support ordering.</p>

<p>=~ which implements regular expression matching.</p>

<p>Your question has prompted me to do a bit of searching to see if I can find a good discussion of the various different comparison operators in Ruby, and there doesn&#8217;t really seem to be anything out there (although there is quite a bit of misinformation!). I may see if I can knock something together for our blog <img src='http://javablog.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://javablog.co.uk/2007/10/13/escape-from-zurg/comment-page-1/#comment-1744</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Sun, 14 Oct 2007 13:06:29 +0000</pubDate>
		<guid isPermaLink="false">http://javablog.co.uk/2007/10/13/escape-from-zurg/#comment-1744</guid>
		<description>&lt;p&gt;Hi Paul, I&#039;ve now updated the &lt;code&gt;moves&lt;/code&gt; method to be more readable and to look more like your Ruby version. I was lazy in not doing it this way before.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Paul, I&#8217;ve now updated the <code>moves</code> method to be more readable and to look more like your Ruby version. I was lazy in not doing it this way before.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://javablog.co.uk/2007/10/13/escape-from-zurg/comment-page-1/#comment-1743</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Sun, 14 Oct 2007 12:20:59 +0000</pubDate>
		<guid isPermaLink="false">http://javablog.co.uk/2007/10/13/escape-from-zurg/#comment-1743</guid>
		<description>&lt;p&gt;You&#039;ve got a good point about the almost duplicated code. In Eclipse the only real code that is autogenerated is the &lt;code&gt;equals&lt;/code&gt; and &lt;code&gt;hashCode&lt;/code&gt;... everything else is from a template. I wonder if it would be possible to use a utility method instead of generating new code every time. Probably not (or it&#039;d be part of the stdlib). I can&#039;t ever imagine wanting to hack the generated code manually... but if somebody did without noting it in comments, they&#039;d be asking for a big can of whoopass.&lt;/p&gt;

&lt;p&gt;How does ruby handle equality (not identity) between objects? And more importantly, how does it handle the pitfall case of class compared against subclass?&lt;/p&gt;

&lt;p&gt;I think I&#039;ll try making those tidying edits to the move method, but I don&#039;t think the Java solution for this problem is going to look as elegant (or anywhere near as terse!) as the ruby one ;-) The main reason being the lack of operator overriding for collections. I really really wish they&#039;d add it one day! I can&#039;t see it happening.&lt;/p&gt;

&lt;p&gt;PS: I&#039;ve added that extra Java code... I didn&#039;t remove it though, it just wasn&#039;t there. This whole code highlighting thing is a bit of a hack to get working with Markdown, so sometimes it just completely falls over. I&#039;ve installed alternatives but they don&#039;t deal with generics very well.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>You&#8217;ve got a good point about the almost duplicated code. In Eclipse the only real code that is autogenerated is the <code>equals</code> and <code>hashCode</code>&#8230; everything else is from a template. I wonder if it would be possible to use a utility method instead of generating new code every time. Probably not (or it&#8217;d be part of the stdlib). I can&#8217;t ever imagine wanting to hack the generated code manually&#8230; but if somebody did without noting it in comments, they&#8217;d be asking for a big can of whoopass.</p>

<p>How does ruby handle equality (not identity) between objects? And more importantly, how does it handle the pitfall case of class compared against subclass?</p>

<p>I think I&#8217;ll try making those tidying edits to the move method, but I don&#8217;t think the Java solution for this problem is going to look as elegant (or anywhere near as terse!) as the ruby one <img src='http://javablog.co.uk/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  The main reason being the lack of operator overriding for collections. I really really wish they&#8217;d add it one day! I can&#8217;t see it happening.</p>

<p>PS: I&#8217;ve added that extra Java code&#8230; I didn&#8217;t remove it though, it just wasn&#8217;t there. This whole code highlighting thing is a bit of a hack to get working with Markdown, so sometimes it just completely falls over. I&#8217;ve installed alternatives but they don&#8217;t deal with generics very well.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://javablog.co.uk/2007/10/13/escape-from-zurg/comment-page-1/#comment-1741</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Sun, 14 Oct 2007 11:51:40 +0000</pubDate>
		<guid isPermaLink="false">http://javablog.co.uk/2007/10/13/escape-from-zurg/#comment-1741</guid>
		<description>&lt;p&gt;Thanks Darren! That plugin is great... I must go and fix up our horrible CSS for the comments now.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks Darren! That plugin is great&#8230; I must go and fix up our horrible CSS for the comments now.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Darren Brierton</title>
		<link>http://javablog.co.uk/2007/10/13/escape-from-zurg/comment-page-1/#comment-1738</link>
		<dc:creator>Darren Brierton</dc:creator>
		<pubDate>Sun, 14 Oct 2007 10:28:28 +0000</pubDate>
		<guid isPermaLink="false">http://javablog.co.uk/2007/10/13/escape-from-zurg/#comment-1738</guid>
		<description>&lt;p&gt;Hey! Don&#039;t take my name in vain! There are indeed several plugins for previewing comments in WordPress.&lt;/p&gt;

&lt;p&gt;Check this:&lt;/p&gt;

&lt;p&gt;http://wordpress.org/extend/plugins/ajax-comment-preview/&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hey! Don&#8217;t take my name in vain! There are indeed several plugins for previewing comments in WordPress.</p>

<p>Check this:</p>

<p><a href="http://wordpress.org/extend/plugins/ajax-comment-preview/" rel="nofollow">http://wordpress.org/extend/plugins/ajax-comment-preview/</a></p>]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Butcher</title>
		<link>http://javablog.co.uk/2007/10/13/escape-from-zurg/comment-page-1/#comment-1737</link>
		<dc:creator>Paul Butcher</dc:creator>
		<pubDate>Sun, 14 Oct 2007 10:24:31 +0000</pubDate>
		<guid isPermaLink="false">http://javablog.co.uk/2007/10/13/escape-from-zurg/#comment-1737</guid>
		<description>&lt;p&gt;Thanks for fixing up my broken tags :-) I&#039;ve just noticed that our site doesn&#039;t have a preview button either (also based on Wordpress). Strikes me as something of an oversight!&lt;/p&gt;

&lt;p&gt;I&#039;m familiar with the argument that because code is automatically generated it doesn&#039;t matter that it&#039;s verbose. I don&#039;t buy it though. It might save you time when you&#039;re writing it in the first place, but it still dramatically affects the maintainability of the codebase. Partly because it increases the amount of &quot;clutter&quot; you have to pick your way through, but mainly because it leads to huge quantities of &quot;almost&quot; duplicated code.&lt;/p&gt;

&lt;p&gt;Almost duplicated code is the worst kind. Purely duplicated code is bad, but almot duplicated code is really dangerous. You either have to pick your way through it every time you read it to make sure that it really is doing what you think it is, or (more likely) you skip over it thinking &quot;ah yes - that&#039;s the standard automatically generated boilerplate&quot;. Which is fine right up until someone has (intentionally or accidentally) modified it. At which point your mental model is broken. And its broken in a way which is particularly difficult to spot because the pattern matching that the human brain is particularly good at suckers you into it.&lt;/p&gt;

&lt;p&gt;It strikes me that there are two ways in which you can cope with complexity. You can automate the process of generating it or you can remove it. That&#039;s the difference between a code generating wizard and something like Rails. I know which of the two I prefer...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks for fixing up my broken tags <img src='http://javablog.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  I&#8217;ve just noticed that our site doesn&#8217;t have a preview button either (also based on WordPress). Strikes me as something of an oversight!</p>

<p>I&#8217;m familiar with the argument that because code is automatically generated it doesn&#8217;t matter that it&#8217;s verbose. I don&#8217;t buy it though. It might save you time when you&#8217;re writing it in the first place, but it still dramatically affects the maintainability of the codebase. Partly because it increases the amount of &#8220;clutter&#8221; you have to pick your way through, but mainly because it leads to huge quantities of &#8220;almost&#8221; duplicated code.</p>

<p>Almost duplicated code is the worst kind. Purely duplicated code is bad, but almot duplicated code is really dangerous. You either have to pick your way through it every time you read it to make sure that it really is doing what you think it is, or (more likely) you skip over it thinking &#8220;ah yes - that&#8217;s the standard automatically generated boilerplate&#8221;. Which is fine right up until someone has (intentionally or accidentally) modified it. At which point your mental model is broken. And its broken in a way which is particularly difficult to spot because the pattern matching that the human brain is particularly good at suckers you into it.</p>

<p>It strikes me that there are two ways in which you can cope with complexity. You can automate the process of generating it or you can remove it. That&#8217;s the difference between a code generating wizard and something like Rails. I know which of the two I prefer&#8230;</p>]]></content:encoded>
	</item>
</channel>
</rss>
