<?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: final, final, final: Your Thoughts?</title>
	<atom:link href="http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/feed/" rel="self" type="application/rss+xml" />
	<link>http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/</link>
	<description>Technology and Geek Stuff by Eric Burke</description>
	<lastBuildDate>Tue, 24 Aug 2010 19:55:26 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Eric Burke</title>
		<link>http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/comment-page-1/#comment-1579</link>
		<dc:creator>Eric Burke</dc:creator>
		<pubDate>Sat, 17 Nov 2007 21:02:57 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/#comment-1579</guid>
		<description>C&#039;mon, guys, where are your Gravatars???</description>
		<content:encoded><![CDATA[<p>C&#8217;mon, guys, where are your Gravatars???</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ignacio Coloma</title>
		<link>http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/comment-page-1/#comment-1553</link>
		<dc:creator>Ignacio Coloma</dc:creator>
		<pubDate>Sat, 17 Nov 2007 11:15:54 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/#comment-1553</guid>
		<description>The case mentioned by Phil happened to me _twice_ in ten years of practice. If there is no performance gain, I find that using &#039;final&#039; is like going against the coding practice of the majority. When a newbie joins your group you will _also_ have to teach him when-and-when-not and get mad when he misuses the annotation.

My learning curve is high enough as it is, thanks.</description>
		<content:encoded><![CDATA[<p>The case mentioned by Phil happened to me _twice_ in ten years of practice. If there is no performance gain, I find that using &#8216;final&#8217; is like going against the coding practice of the majority. When a newbie joins your group you will _also_ have to teach him when-and-when-not and get mad when he misuses the annotation.</p>
<p>My learning curve is high enough as it is, thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Bourrillion</title>
		<link>http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/comment-page-1/#comment-1548</link>
		<dc:creator>Kevin Bourrillion</dc:creator>
		<pubDate>Sat, 17 Nov 2007 09:33:54 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/#comment-1548</guid>
		<description>Sheesh, it&#039;s nice to see that at least a _couple_ people in there actually understood the question!</description>
		<content:encoded><![CDATA[<p>Sheesh, it&#8217;s nice to see that at least a _couple_ people in there actually understood the question!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kirk</title>
		<link>http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/comment-page-1/#comment-1546</link>
		<dc:creator>Kirk</dc:creator>
		<pubDate>Sat, 17 Nov 2007 09:10:50 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/#comment-1546</guid>
		<description>Not against final but it does breaks the possibility for extending so it should be used with care.</description>
		<content:encoded><![CDATA[<p>Not against final but it does breaks the possibility for extending so it should be used with care.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gordon</title>
		<link>http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/comment-page-1/#comment-1530</link>
		<dc:creator>Gordon</dc:creator>
		<pubDate>Fri, 16 Nov 2007 23:59:14 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/#comment-1530</guid>
		<description>I use final for - of course - nested classes btw faking/mocking/stubing class/object-behaviour during unit-testing (no other chance) within some kind of fake/mock/stub-creational methods.

Sometimes I use final on production code if I know myself: remindering me not to change the input properties (next difficulty: what is the second best parameter name?!). These situations are very rare and more of the kind of syntactic sugar.

I ALWAYS use the final keyword for JUnit test-methods (have thought about it long time): Just be be sure not no override a testcase- and/or setup-method in a subclass (of a fixture). 

Gordon</description>
		<content:encoded><![CDATA[<p>I use final for &#8211; of course &#8211; nested classes btw faking/mocking/stubing class/object-behaviour during unit-testing (no other chance) within some kind of fake/mock/stub-creational methods.</p>
<p>Sometimes I use final on production code if I know myself: remindering me not to change the input properties (next difficulty: what is the second best parameter name?!). These situations are very rare and more of the kind of syntactic sugar.</p>
<p>I ALWAYS use the final keyword for JUnit test-methods (have thought about it long time): Just be be sure not no override a testcase- and/or setup-method in a subclass (of a fixture). </p>
<p>Gordon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil</title>
		<link>http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/comment-page-1/#comment-1519</link>
		<dc:creator>Phil</dc:creator>
		<pubDate>Fri, 16 Nov 2007 20:51:27 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/#comment-1519</guid>
		<description>Yes, because it prevents this typo:


private int value = ...

public void setValue(int value){
   value = value;  //oops, forgot this
}


This is a trivial example, there there are more complex examples where you accidentally assign to variable you meant to retrieve a value from.

As someone mentioned above, I think the performance gain is no longer there because the compiler is better about determining if the variable is mutated or not and doing the appropriate optimizations if it isn&#039;t.  

I look at it sort of like Override-- most of the time it doesn&#039;t matter, but the time you leave it out will be the time you spend two hours trying to figure out why your method isn&#039;t being called because you put the wrong generified type on it... say, like this morning.</description>
		<content:encoded><![CDATA[<p>Yes, because it prevents this typo:</p>
<p>private int value = &#8230;</p>
<p>public void setValue(int value){<br />
   value = value;  //oops, forgot this<br />
}</p>
<p>This is a trivial example, there there are more complex examples where you accidentally assign to variable you meant to retrieve a value from.</p>
<p>As someone mentioned above, I think the performance gain is no longer there because the compiler is better about determining if the variable is mutated or not and doing the appropriate optimizations if it isn&#8217;t.  </p>
<p>I look at it sort of like Override&#8211; most of the time it doesn&#8217;t matter, but the time you leave it out will be the time you spend two hours trying to figure out why your method isn&#8217;t being called because you put the wrong generified type on it&#8230; say, like this morning.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex Miler</title>
		<link>http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/comment-page-1/#comment-1515</link>
		<dc:creator>Alex Miler</dc:creator>
		<pubDate>Fri, 16 Nov 2007 19:53:45 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/#comment-1515</guid>
		<description>I&#039;ve tried both for a while.  I find using final in method parameters and local variables to just be way too annoying.  I would much prefer it if &quot;final&quot; was the default and you had to mark the ones that can be changed as &quot;mutable&quot;.  But since that&#039;s an alternate dimension, I say none.

Sometimes I mark method parameters in the case where some are being modified and some are not to indicate which are the &quot;input&quot; and which are the &quot;inout&quot; or &quot;output&quot;.  

However, I believe it&#039;s highly worth marking object fields as final and I strive to accurately label immutability there and hopefully to mark everything as immutable if possible.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve tried both for a while.  I find using final in method parameters and local variables to just be way too annoying.  I would much prefer it if &#8220;final&#8221; was the default and you had to mark the ones that can be changed as &#8220;mutable&#8221;.  But since that&#8217;s an alternate dimension, I say none.</p>
<p>Sometimes I mark method parameters in the case where some are being modified and some are not to indicate which are the &#8220;input&#8221; and which are the &#8220;inout&#8221; or &#8220;output&#8221;.  </p>
<p>However, I believe it&#8217;s highly worth marking object fields as final and I strive to accurately label immutability there and hopefully to mark everything as immutable if possible.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jesse</title>
		<link>http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/comment-page-1/#comment-1512</link>
		<dc:creator>Jesse</dc:creator>
		<pubDate>Fri, 16 Nov 2007 17:37:53 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/#comment-1512</guid>
		<description>I rarely redefine stuff, so final feels like unnecessary cruft. I like to the signal-to-noise ratio as high as possible in my code.</description>
		<content:encoded><![CDATA[<p>I rarely redefine stuff, so final feels like unnecessary cruft. I like to the signal-to-noise ratio as high as possible in my code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/comment-page-1/#comment-1511</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Fri, 16 Nov 2007 17:00:50 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/#comment-1511</guid>
		<description>Definitely a style issue rather than a best practices issue. Personally, I prefer to reserve the &quot;final&quot; notation for those parameters and variables that will be accessed from an inner/nested class.

I do use &quot;final&quot; quite a bit on fields, though. It&#039;s good to know which fields are mutable state and which aren&#039;t. Also, I&#039;m not at all shy about making final fields public rather than create getters for them.</description>
		<content:encoded><![CDATA[<p>Definitely a style issue rather than a best practices issue. Personally, I prefer to reserve the &#8220;final&#8221; notation for those parameters and variables that will be accessed from an inner/nested class.</p>
<p>I do use &#8220;final&#8221; quite a bit on fields, though. It&#8217;s good to know which fields are mutable state and which aren&#8217;t. Also, I&#8217;m not at all shy about making final fields public rather than create getters for them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Winters</title>
		<link>http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/comment-page-1/#comment-1506</link>
		<dc:creator>Chris Winters</dc:creator>
		<pubDate>Fri, 16 Nov 2007 16:36:31 +0000</pubDate>
		<guid isPermaLink="false">http://stuffthathappens.com/blog/2007/11/16/final-final-final-your-thoughts/#comment-1506</guid>
		<description>I think final is useful not only to enforce certain behaviors (immutability), but also to indicate what type of code you&#039;re working with -- see Reg Braithwaite&#039;s recent post on coding conventions (http://weblog.raganwald.com/2007/11/programming-conventions-as-signals.html). Even though a final object can still be modified thru mutators, knowing that I&#039;m passing in &#039;final&#039; parameters indicates to me that the method I&#039;m invoking won&#039;t screw with my objects, that the side-effects will be limited to none.</description>
		<content:encoded><![CDATA[<p>I think final is useful not only to enforce certain behaviors (immutability), but also to indicate what type of code you&#8217;re working with &#8212; see Reg Braithwaite&#8217;s recent post on coding conventions (<a href="http://weblog.raganwald.com/2007/11/programming-conventions-as-signals.html)" rel="nofollow">http://weblog.raganwald.com/2007/11/programming-conventions-as-signals.html)</a>. Even though a final object can still be modified thru mutators, knowing that I&#8217;m passing in &#8216;final&#8217; parameters indicates to me that the method I&#8217;m invoking won&#8217;t screw with my objects, that the side-effects will be limited to none.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.257 seconds -->
