<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments for Just about anything</title>
	<atom:link href="http://calvinkrishy.wordpress.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://calvinkrishy.wordpress.com</link>
	<description>Yet another blog about programming, technology and general musings on life</description>
	<lastBuildDate>Wed, 22 Nov 2006 11:46:09 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on const-ness in Java by Ricky Clarkson</title>
		<link>http://calvinkrishy.wordpress.com/2006/11/22/const-ness-in-java/#comment-6</link>
		<dc:creator>Ricky Clarkson</dc:creator>
		<pubDate>Wed, 22 Nov 2006 11:46:09 +0000</pubDate>
		<guid isPermaLink="false">http://calvinkrishy.wordpress.com/2006/11/22/const-ness-in-java/#comment-6</guid>
		<description>&quot;Should the contact object be immutable? Of course not.&quot;

I don&#039;t find your logic convincing.  People change their contact details, but in software we might choose to retain the old information, maybe marking it as old, for record-keeping purposes.  Mutating the contact details loses the old information.

I could make the Person immutable too, and whenever I need to update the Person I create a new Person object and use that from now on.

In my code I often replace setters with &#039;withers&#039;, e.g.: netBlock.withNetMask(&quot;255.255.255.0&quot;) creates a new NetBlock with the same info as the original, except with the new NetMask.  It&#039;s just an application of the Builder pattern.</description>
		<content:encoded><![CDATA[<p>&#8220;Should the contact object be immutable? Of course not.&#8221;</p>
<p>I don&#8217;t find your logic convincing.  People change their contact details, but in software we might choose to retain the old information, maybe marking it as old, for record-keeping purposes.  Mutating the contact details loses the old information.</p>
<p>I could make the Person immutable too, and whenever I need to update the Person I create a new Person object and use that from now on.</p>
<p>In my code I often replace setters with &#8216;withers&#8217;, e.g.: netBlock.withNetMask(&#8220;255.255.255.0&#8243;) creates a new NetBlock with the same info as the original, except with the new NetMask.  It&#8217;s just an application of the Builder pattern.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Immutability by const-ness in Java &#171; Just about anything</title>
		<link>http://calvinkrishy.wordpress.com/2006/11/02/immutability/#comment-5</link>
		<dc:creator>const-ness in Java &#171; Just about anything</dc:creator>
		<pubDate>Wed, 22 Nov 2006 09:27:25 +0000</pubDate>
		<guid isPermaLink="false">http://calvinkrishy.wordpress.com/2006/11/02/immutability/#comment-5</guid>
		<description>[...] Comments (RSS)       &#171; Immutability [...]</description>
		<content:encoded><![CDATA[<p>[...] Comments (RSS)       &laquo; Immutability [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Immutability by calvinkrishy</title>
		<link>http://calvinkrishy.wordpress.com/2006/11/02/immutability/#comment-4</link>
		<dc:creator>calvinkrishy</dc:creator>
		<pubDate>Mon, 06 Nov 2006 14:00:40 +0000</pubDate>
		<guid isPermaLink="false">http://calvinkrishy.wordpress.com/2006/11/02/immutability/#comment-4</guid>
		<description>@Mikael
Thanks, that was an informative article.

@Ricky
Nice factory patternish approach but one downside I guess is that instead of having to maintain one single class, we now have to take care of an interface and an anonymous class.

Yes, wordpress seems to have swallowed the generics  type definition :). Thanks for pointing that out! Fixed that now.</description>
		<content:encoded><![CDATA[<p>@Mikael<br />
Thanks, that was an informative article.</p>
<p>@Ricky<br />
Nice factory patternish approach but one downside I guess is that instead of having to maintain one single class, we now have to take care of an interface and an anonymous class.</p>
<p>Yes, wordpress seems to have swallowed the generics  type definition <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Thanks for pointing that out! Fixed that now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Immutability by Ricky Clarkson</title>
		<link>http://calvinkrishy.wordpress.com/2006/11/02/immutability/#comment-3</link>
		<dc:creator>Ricky Clarkson</dc:creator>
		<pubDate>Sun, 05 Nov 2006 14:21:34 +0000</pubDate>
		<guid isPermaLink="false">http://calvinkrishy.wordpress.com/2006/11/02/immutability/#comment-3</guid>
		<description>Your code samples seem aimed at 1.5 without generics, which seems odd - untyped collections but foreach loops.  I just looked back through the code, and I&#039;d guess that your blogging software swallowed your generics. ;)

I would also mention anonymous classes as a way of implementing immutability.  If a class has no fields then instances of it are immutable.  Of course, anonymous classes generate fields from local variables of the enclosing scope, but they are final.

interface Complex
{
        double getReal();
        double getImag();
}

public static Complex complex(final double real,final double imag)
{
        return new Complex()
        {
                public double getReal()
                {
                        return real;
                }

                public double getImag()
                {
                        return imag;
                }
        };
}

Then you get immutability for no extra effort - you can no longer make the mistake of forgetting &#039;final&#039; on the class definition, as it is implicitly final already.

Not only that, but the perceived effect of implementing an interface anonymously is that nobody thinks &quot;I&#039;d like to subclass that, why can&#039;t I?&quot;.</description>
		<content:encoded><![CDATA[<p>Your code samples seem aimed at 1.5 without generics, which seems odd &#8211; untyped collections but foreach loops.  I just looked back through the code, and I&#8217;d guess that your blogging software swallowed your generics. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I would also mention anonymous classes as a way of implementing immutability.  If a class has no fields then instances of it are immutable.  Of course, anonymous classes generate fields from local variables of the enclosing scope, but they are final.</p>
<p>interface Complex<br />
{<br />
        double getReal();<br />
        double getImag();<br />
}</p>
<p>public static Complex complex(final double real,final double imag)<br />
{<br />
        return new Complex()<br />
        {<br />
                public double getReal()<br />
                {<br />
                        return real;<br />
                }</p>
<p>                public double getImag()<br />
                {<br />
                        return imag;<br />
                }<br />
        };<br />
}</p>
<p>Then you get immutability for no extra effort &#8211; you can no longer make the mistake of forgetting &#8216;final&#8217; on the class definition, as it is implicitly final already.</p>
<p>Not only that, but the perceived effect of implementing an interface anonymously is that nobody thinks &#8220;I&#8217;d like to subclass that, why can&#8217;t I?&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Immutability by Mikael Grev</title>
		<link>http://calvinkrishy.wordpress.com/2006/11/02/immutability/#comment-2</link>
		<dc:creator>Mikael Grev</dc:creator>
		<pubDate>Sun, 05 Nov 2006 07:18:33 +0000</pubDate>
		<guid isPermaLink="false">http://calvinkrishy.wordpress.com/2006/11/02/immutability/#comment-2</guid>
		<description>If you are interested in immutability there is an article I wrote a while ago: http://www.javalobby.org/members-only/articles/immutable/index.jsp?source=archives

Cheers,
Mikael</description>
		<content:encoded><![CDATA[<p>If you are interested in immutability there is an article I wrote a while ago: <a href="http://www.javalobby.org/members-only/articles/immutable/index.jsp?source=archives" rel="nofollow">http://www.javalobby.org/members-only/articles/immutable/index.jsp?source=archives</a></p>
<p>Cheers,<br />
Mikael</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Hello world! by Mr WordPress</title>
		<link>http://calvinkrishy.wordpress.com/2006/06/25/hello-world/#comment-1</link>
		<dc:creator>Mr WordPress</dc:creator>
		<pubDate>Sun, 25 Jun 2006 08:41:11 +0000</pubDate>
		<guid isPermaLink="false">#comment-1</guid>
		<description>Hi, this is a comment.&lt;br /&gt;To delete a comment, just log in, and view the posts&#039; comments, there you will have the option to edit or delete them.</description>
		<content:encoded><![CDATA[<p>Hi, this is a comment.<br />To delete a comment, just log in, and view the posts&#8217; comments, there you will have the option to edit or delete them.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
