<?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: Go Ahead: Next Generation Java Programming Style</title>
	<atom:link href="http://codemonkeyism.com/generation-java-programming-style/feed/" rel="self" type="application/rss+xml" />
	<link>http://codemonkeyism.com/generation-java-programming-style/</link>
	<description></description>
	<lastBuildDate>Mon, 15 Mar 2010 13:03:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Symphonious &#187; Show Me the Metrics</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-274757</link>
		<dc:creator>Symphonious &#187; Show Me the Metrics</dc:creator>
		<pubDate>Wed, 03 Mar 2010 14:54:43 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-274757</guid>
		<description>[...] posts like Stephan Schmidt’s Go Ahead: Next Generation Java Programming Style and the response from Cedric Otaku really should make any professional software engineer concerned [...]</description>
		<content:encoded><![CDATA[<p>[...] posts like Stephan Schmidt’s Go Ahead: Next Generation Java Programming Style and the response from Cedric Otaku really should make any professional software engineer concerned [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Georgi</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-263160</link>
		<dc:creator>Georgi</dc:creator>
		<pubDate>Thu, 07 Jan 2010 23:03:26 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-263160</guid>
		<description>Point #3 was particularly interesting but I don&#039;t agree so much with point #4 as I find that to be unreadable.
Interesting post overall :)</description>
		<content:encoded><![CDATA[<p>Point #3 was particularly interesting but I don&#8217;t agree so much with point #4 as I find that to be unreadable.<br />
Interesting post overall :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-251074</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Wed, 04 Nov 2009 23:16:56 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-251074</guid>
		<description>@dyu: I think if it&#039;s part of an API, I would not remove getters. If there are clients you do not control, public fields might be troublesome.

For deeper considerations about public APIs, I suggest reading the most excellent:

&quot;Practical API Design: Confessions of a Java Framework Architect (Hardcover)&quot;

http://www.amazon.com/Practical-API-Design-Confessions-Framework/dp/1430209739</description>
		<content:encoded><![CDATA[<p>@dyu: I think if it&#8217;s part of an API, I would not remove getters. If there are clients you do not control, public fields might be troublesome.</p>
<p>For deeper considerations about public APIs, I suggest reading the most excellent:</p>
<p>&#8220;Practical API Design: Confessions of a Java Framework Architect (Hardcover)&#8221;</p>
<p><a href="http://www.amazon.com/Practical-API-Design-Confessions-Framework/dp/1430209739" rel="nofollow">http://www.amazon.com/Practical-API-Design-Confessions-Framework/dp/1430209739</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dyu</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-251033</link>
		<dc:creator>dyu</dc:creator>
		<pubDate>Wed, 04 Nov 2009 18:29:29 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-251033</guid>
		<description>#2 and #8 most definitely agree.
I partially agree with #1 but not on local variables as it tends to be clutter.



One question, for #8, if the code is to be used as a library (opensource)... would you still lean on removing the getters?

Normal java developers who consume your code tend to look for public getters all the time.

All-in-all, very intersting points!</description>
		<content:encoded><![CDATA[<p>#2 and #8 most definitely agree.<br />
I partially agree with #1 but not on local variables as it tends to be clutter.</p>
<p>One question, for #8, if the code is to be used as a library (opensource)&#8230; would you still lean on removing the getters?</p>
<p>Normal java developers who consume your code tend to look for public getters all the time.</p>
<p>All-in-all, very intersting points!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Go Ahead: Next Generation Java Programming Style &#124; Around the Web in 80 Minutes</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-248648</link>
		<dc:creator>Go Ahead: Next Generation Java Programming Style &#124; Around the Web in 80 Minutes</dc:creator>
		<pubDate>Tue, 20 Oct 2009 07:28:44 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-248648</guid>
		<description>[...] http://codemonkeyism.com/generation-java-programming-style/   Share This [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://codemonkeyism.com/generation-java-programming-style/" rel="nofollow">http://codemonkeyism.com/generation-java-programming-style/</a>   Share This [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rgz</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-244219</link>
		<dc:creator>rgz</dc:creator>
		<pubDate>Thu, 17 Sep 2009 01:24:51 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-244219</guid>
		<description>Ignacio Coloma nails it for me, however it&#039;s nice to see people fighting to revitalize Java style.</description>
		<content:encoded><![CDATA[<p>Ignacio Coloma nails it for me, however it&#8217;s nice to see people fighting to revitalize Java style.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-242569</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Sun, 06 Sep 2009 11:44:40 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-242569</guid>
		<description>@Mario: Nice, I will take a look. Thanks.</description>
		<content:encoded><![CDATA[<p>@Mario: Nice, I will take a look. Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mario Fusco</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-242564</link>
		<dc:creator>Mario Fusco</dc:creator>
		<pubDate>Sun, 06 Sep 2009 10:27:27 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-242564</guid>
		<description>Great post, really.

About #3 there is in my opinion also a better solution. Give a look to the lambdaj library:

http://code.google.com/p/lambdaj/

and you will discover that your example could be rewritten without loops or anonymous inner classes as it follows:

List beerDrinkers = select(persons, having(on(Person.class).getAge(), greaterThan(16)));

Cheers
Mario</description>
		<content:encoded><![CDATA[<p>Great post, really.</p>
<p>About #3 there is in my opinion also a better solution. Give a look to the lambdaj library:</p>
<p><a href="http://code.google.com/p/lambdaj/" rel="nofollow">http://code.google.com/p/lambdaj/</a></p>
<p>and you will discover that your example could be rewritten without loops or anonymous inner classes as it follows:</p>
<p>List beerDrinkers = select(persons, having(on(Person.class).getAge(), greaterThan(16)));</p>
<p>Cheers<br />
Mario</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott C</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-241810</link>
		<dc:creator>Scott C</dc:creator>
		<pubDate>Tue, 01 Sep 2009 07:00:54 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-241810</guid>
		<description>I agree that most of the reduction of programming errors by using Functional languages (Scala,etc) could be accomplished using similar methods to reduce state in Java.  Many of these suggestions are similar to those in the &quot;Effective Java/Joshua Block&quot; book.

My only problem with passing everything in immutible chunks is that it requires so many helper classes to be defined and makes handling the program in the eclipse ide a lot more cumbersome.  For a single boolean true/false flag to be added to a transaction  requires a lot more work than just having a getter/setter.

Also the main concept of the Scala actors model can be easily accomplished using a BlockQueue with immutible messages in java.  This would not scale to ultra high volumes however due to the context switching.  I understand the &#039;react&#039; command in Scala allows the next actor to stay on the same thread.</description>
		<content:encoded><![CDATA[<p>I agree that most of the reduction of programming errors by using Functional languages (Scala,etc) could be accomplished using similar methods to reduce state in Java.  Many of these suggestions are similar to those in the &#8220;Effective Java/Joshua Block&#8221; book.</p>
<p>My only problem with passing everything in immutible chunks is that it requires so many helper classes to be defined and makes handling the program in the eclipse ide a lot more cumbersome.  For a single boolean true/false flag to be added to a transaction  requires a lot more work than just having a getter/setter.</p>
<p>Also the main concept of the Scala actors model can be easily accomplished using a BlockQueue with immutible messages in java.  This would not scale to ultra high volumes however due to the context switching.  I understand the &#8216;react&#8217; command in Scala allows the next actor to stay on the same thread.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-240891</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Tue, 25 Aug 2009 10:05:32 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-240891</guid>
		<description>&quot;Final is your new love&quot; - if you write your software properly then this doesn&#039;t happen. I can&#039;t really think of a single scenario in the last 10 years where this would have helped me find or prevent a bug. It is just additional noise.

&quot;No setters&quot; - debatable. I am a believer in consistency and it should then be either the one or the other. However, I can think of way more scenarios for using setters than not using them. Therefore I think this shouldn&#039;t be done. Generating setters is cheap in the IDE so just use them. 

&quot;Do not use loops for list operations&quot; - that is IMHO by far the stupidest suggestion and an even more stupid justification: &quot;easier to understand&quot;. This is just preference and this whole thing on closures and predicates is nice but it looks like the hammer-nail pattern. Way too much noise there.

&quot;Use one liners&quot; - again preference. I would choose a third option:

    public int add(int a, int b) {
        return a+b;
    }

&quot;Use many, many objects with many interfaces&quot; - again preference. Using interfaces doesn&#039;t solve any problem and when using interfaces you can&#039;t access the properties directly hence access through getter and setter methods and a direct contradiction to &quot;No setters&quot;.

&quot;Use Erlang-Style Concurrency&quot; - don&#039;t know enough about this to have an opinion

&quot;Use Fluent Interfaces&quot; - again preference. This is the new JavaScript programming style but I don&#039;t like it. The biggest downside is debugging as you cannot set a breakpoint on a specific method call as this is all one big line.

&quot;Data Transfer Objects without setters and getters&quot; - again preference although I can see some benefit of immutable objects. However, this should be available through the langugage which it isn&#039;t. Java is not Erlang. Refactoring is easy with well designed objects, properly managed code and a good IDE. This has more to do with the quality of the programmer and the tools than the programming style.

Frank</description>
		<content:encoded><![CDATA[<p>&#8220;Final is your new love&#8221; &#8211; if you write your software properly then this doesn&#8217;t happen. I can&#8217;t really think of a single scenario in the last 10 years where this would have helped me find or prevent a bug. It is just additional noise.</p>
<p>&#8220;No setters&#8221; &#8211; debatable. I am a believer in consistency and it should then be either the one or the other. However, I can think of way more scenarios for using setters than not using them. Therefore I think this shouldn&#8217;t be done. Generating setters is cheap in the IDE so just use them. </p>
<p>&#8220;Do not use loops for list operations&#8221; &#8211; that is IMHO by far the stupidest suggestion and an even more stupid justification: &#8220;easier to understand&#8221;. This is just preference and this whole thing on closures and predicates is nice but it looks like the hammer-nail pattern. Way too much noise there.</p>
<p>&#8220;Use one liners&#8221; &#8211; again preference. I would choose a third option:</p>
<p>    public int add(int a, int b) {<br />
        return a+b;<br />
    }</p>
<p>&#8220;Use many, many objects with many interfaces&#8221; &#8211; again preference. Using interfaces doesn&#8217;t solve any problem and when using interfaces you can&#8217;t access the properties directly hence access through getter and setter methods and a direct contradiction to &#8220;No setters&#8221;.</p>
<p>&#8220;Use Erlang-Style Concurrency&#8221; &#8211; don&#8217;t know enough about this to have an opinion</p>
<p>&#8220;Use Fluent Interfaces&#8221; &#8211; again preference. This is the new JavaScript programming style but I don&#8217;t like it. The biggest downside is debugging as you cannot set a breakpoint on a specific method call as this is all one big line.</p>
<p>&#8220;Data Transfer Objects without setters and getters&#8221; &#8211; again preference although I can see some benefit of immutable objects. However, this should be available through the langugage which it isn&#8217;t. Java is not Erlang. Refactoring is easy with well designed objects, properly managed code and a good IDE. This has more to do with the quality of the programmer and the tools than the programming style.</p>
<p>Frank</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: a little madness &#187; Blog Archive &#187; Functional vs &#8220;Java&#8221; Style</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-240065</link>
		<dc:creator>a little madness &#187; Blog Archive &#187; Functional vs &#8220;Java&#8221; Style</dc:creator>
		<pubDate>Thu, 20 Aug 2009 13:36:14 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-240065</guid>
		<description>[...] Schmidt started it with his third point: Do not use loops for list operations. Learning from functional languages, [...]</description>
		<content:encoded><![CDATA[<p>[...] Schmidt started it with his third point: Do not use loops for list operations. Learning from functional languages, [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: erich</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-239438</link>
		<dc:creator>erich</dc:creator>
		<pubDate>Sat, 15 Aug 2009 04:24:55 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-239438</guid>
		<description>Hi,

New to your blog, and not trying to flame at all, but just my opinion on one in particular. I have a real aversion to suggestion #4. One-liners are awful things. Why should the number of characters in a method determine its formatting? This opens the door for any number of conditionals just to determine how your whitespace looks. The trivial example of the &quot;add&quot; method works, but this needs a giant EULA-style rulebook to avoid something like this trivial example:

public long fibonacci(int n){return n&lt;=1?n:fibonacci(n-1)+fibonacci(n-2);}

It would be better suited to conditionals that the compiler would optimize anyway. Introduce a 55 char per line convention (unrealistic, but for example), maybe I should just call the method &quot;fib&quot; so it &quot;fits on one line&quot;.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>New to your blog, and not trying to flame at all, but just my opinion on one in particular. I have a real aversion to suggestion #4. One-liners are awful things. Why should the number of characters in a method determine its formatting? This opens the door for any number of conditionals just to determine how your whitespace looks. The trivial example of the &#8220;add&#8221; method works, but this needs a giant EULA-style rulebook to avoid something like this trivial example:</p>
<p>public long fibonacci(int n){return n&lt;=1?n:fibonacci(n-1)+fibonacci(n-2);}</p>
<p>It would be better suited to conditionals that the compiler would optimize anyway. Introduce a 55 char per line convention (unrealistic, but for example), maybe I should just call the method &#8220;fib&#8221; so it &#8220;fits on one line&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Smith</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-3/#comment-239390</link>
		<dc:creator>John Smith</dc:creator>
		<pubDate>Fri, 14 Aug 2009 19:03:55 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-239390</guid>
		<description>Why don&#039;t we leave Java alone and you come up with your own new language you can use yourself.  Your list is like saying &quot;Let&#039;s talk in English with all Spanish words&quot;.

Java is fine the way it is.  It works and it isn&#039;t hard to teach and use.  Add all this stuff and it will be difficult to use.</description>
		<content:encoded><![CDATA[<p>Why don&#8217;t we leave Java alone and you come up with your own new language you can use yourself.  Your list is like saying &#8220;Let&#8217;s talk in English with all Spanish words&#8221;.</p>
<p>Java is fine the way it is.  It works and it isn&#8217;t hard to teach and use.  Add all this stuff and it will be difficult to use.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jaroslaw Dobrzanski</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-3/#comment-239056</link>
		<dc:creator>Jaroslaw Dobrzanski</dc:creator>
		<pubDate>Wed, 12 Aug 2009 07:15:42 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-239056</guid>
		<description>I liked &#039;Final is your new love&#039;, &#039;No setters&#039;, and &#039;Use many, many objects with many interfaces&#039;. &#039;Do not use loops for list operations&#039; was interesting too - I&#039;ve never used Google collection filter before.

Now, I wouldn&#039;t agree &#039;Use one liners&#039; is that good. I like one liners but still instead of 
public int add(int a, int b) { return a + b; }

I would use 
public int add(int a, int b) 
{ 
	return a + b; 
}

Anyway, everybody has their own style.

Cheers,
Jarek</description>
		<content:encoded><![CDATA[<p>I liked &#8216;Final is your new love&#8217;, &#8216;No setters&#8217;, and &#8216;Use many, many objects with many interfaces&#8217;. &#8216;Do not use loops for list operations&#8217; was interesting too &#8211; I&#8217;ve never used Google collection filter before.</p>
<p>Now, I wouldn&#8217;t agree &#8216;Use one liners&#8217; is that good. I like one liners but still instead of<br />
public int add(int a, int b) { return a + b; }</p>
<p>I would use<br />
public int add(int a, int b)<br />
{<br />
	return a + b;<br />
}</p>
<p>Anyway, everybody has their own style.</p>
<p>Cheers,<br />
Jarek</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ray</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-3/#comment-239009</link>
		<dc:creator>Ray</dc:creator>
		<pubDate>Tue, 11 Aug 2009 18:37:27 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-239009</guid>
		<description>The list seems to be a feature set of Scala.  You get all of those items in idiomatic Scala as opposed to trying to improve Java via the use of a rather non-idiomatic style.

Scala is Java done correctly.  And more.</description>
		<content:encoded><![CDATA[<p>The list seems to be a feature set of Scala.  You get all of those items in idiomatic Scala as opposed to trying to improve Java via the use of a rather non-idiomatic style.</p>
<p>Scala is Java done correctly.  And more.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cedric</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-3/#comment-238990</link>
		<dc:creator>Cedric</dc:creator>
		<pubDate>Tue, 11 Aug 2009 15:50:44 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-238990</guid>
		<description>Sorry Stephan, but I disagree with most of your suggestions :-)

More detailed response on my blog:

http://beust.com/weblog/archives/000517.html</description>
		<content:encoded><![CDATA[<p>Sorry Stephan, but I disagree with most of your suggestions :-)</p>
<p>More detailed response on my blog:</p>
<p><a href="http://beust.com/weblog/archives/000517.html" rel="nofollow">http://beust.com/weblog/archives/000517.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Fischer</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-3/#comment-238983</link>
		<dc:creator>Robert Fischer</dc:creator>
		<pubDate>Tue, 11 Aug 2009 13:40:54 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-238983</guid>
		<description>#1 through #7 is saying to adopt a more functional style of programming, which I&#039;m a fan of:

http://enfranchisedmind.com/blog/posts/this-is-your-brain-this-is-your-brain-on-ocaml/
http://enfranchisedmind.com/blog/posts/object-burn-is-your-friend/
http://enfranchisedmind.com/blog/posts/some-final-patterns/

Java really screws you with #8.  Unlike C# and Groovy, refactoring a public field is *not* trivial in the user code.  So you&#039;re pretty much toast if the object is ever going to be maintained moving forward.  And if you&#039;re going to making things fragile with malice of foresight, you should probably make the class final, too, just so you don&#039;t take other people down with you.  I&#039;d actually suggest implementing #8 by writing that code in Groovy, even if you&#039;re calling it from Java: you&#039;ll get the implicit getters and setters for free, along with the code readability.</description>
		<content:encoded><![CDATA[<p>#1 through #7 is saying to adopt a more functional style of programming, which I&#8217;m a fan of:</p>
<p><a href="http://enfranchisedmind.com/blog/posts/this-is-your-brain-this-is-your-brain-on-ocaml/" rel="nofollow">http://enfranchisedmind.com/blog/posts/this-is-your-brain-this-is-your-brain-on-ocaml/</a><br />
<a href="http://enfranchisedmind.com/blog/posts/object-burn-is-your-friend/" rel="nofollow">http://enfranchisedmind.com/blog/posts/object-burn-is-your-friend/</a><br />
<a href="http://enfranchisedmind.com/blog/posts/some-final-patterns/" rel="nofollow">http://enfranchisedmind.com/blog/posts/some-final-patterns/</a></p>
<p>Java really screws you with #8.  Unlike C# and Groovy, refactoring a public field is *not* trivial in the user code.  So you&#8217;re pretty much toast if the object is ever going to be maintained moving forward.  And if you&#8217;re going to making things fragile with malice of foresight, you should probably make the class final, too, just so you don&#8217;t take other people down with you.  I&#8217;d actually suggest implementing #8 by writing that code in Groovy, even if you&#8217;re calling it from Java: you&#8217;ll get the implicit getters and setters for free, along with the code readability.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ignacio Coloma</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-3/#comment-238951</link>
		<dc:creator>Ignacio Coloma</dc:creator>
		<pubDate>Tue, 11 Aug 2009 10:02:11 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-238951</guid>
		<description>Sorry, but I do not agree with some of these points:

#1 &quot;final makes code easier to read&quot;: Final is yet another word that has to be processed by the reader. If the point is avoiding bugs, I would recommend FindBugs instead.

#2 You are using Tell Don&#039;t Ask as the holy grail. For me, creating an isOlderThan() method goes against The Simplest Thing that Could Possibly Work and DRY (next: isYoungerThan, isOlderOrEqualsThan, etc). Sure, you can create a Domain method for every possible operation but then your domain classes will not scale too well, and it goes a bit against OO 101.

#3 Closures are one thing, but here you are changing one idiom with another. There is no gain in number of lines of code, readability and (certainly not) performance.

#4 one-liners does not improve readability, but save space, which is not the same thing. Breaking the expected vertical rythm makes code harder to read in most cases.

#5 implies that &quot;many interfaces&quot; == &quot;better reusability&quot;. This depends on the environment (the &quot;forces&quot; if you are talking about patterns), and cannot be applied as a general rule of thumb. I have seen plenty of idiotic interfaces out there, solving problems that proper encapsulation and inheritance would do much better.

#8 only applies if there is nobody else using your code. As soon as your library is used by third parties, refactoring would break things.

As a side comment, injecting the Twitter feeds into the comments section really lowers the S/N ratio of this thread.</description>
		<content:encoded><![CDATA[<p>Sorry, but I do not agree with some of these points:</p>
<p>#1 &#8220;final makes code easier to read&#8221;: Final is yet another word that has to be processed by the reader. If the point is avoiding bugs, I would recommend FindBugs instead.</p>
<p>#2 You are using Tell Don&#8217;t Ask as the holy grail. For me, creating an isOlderThan() method goes against The Simplest Thing that Could Possibly Work and DRY (next: isYoungerThan, isOlderOrEqualsThan, etc). Sure, you can create a Domain method for every possible operation but then your domain classes will not scale too well, and it goes a bit against OO 101.</p>
<p>#3 Closures are one thing, but here you are changing one idiom with another. There is no gain in number of lines of code, readability and (certainly not) performance.</p>
<p>#4 one-liners does not improve readability, but save space, which is not the same thing. Breaking the expected vertical rythm makes code harder to read in most cases.</p>
<p>#5 implies that &#8220;many interfaces&#8221; == &#8220;better reusability&#8221;. This depends on the environment (the &#8220;forces&#8221; if you are talking about patterns), and cannot be applied as a general rule of thumb. I have seen plenty of idiotic interfaces out there, solving problems that proper encapsulation and inheritance would do much better.</p>
<p>#8 only applies if there is nobody else using your code. As soon as your library is used by third parties, refactoring would break things.</p>
<p>As a side comment, injecting the Twitter feeds into the comments section really lowers the S/N ratio of this thread.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Lenards</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-2/#comment-238789</link>
		<dc:creator>Andrew Lenards</dc:creator>
		<pubDate>Mon, 10 Aug 2009 17:53:01 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-238789</guid>
		<description>Thanks - it&#039;s great to see all these excellent memes in one place. And I appreciate the links!</description>
		<content:encoded><![CDATA[<p>Thanks &#8211; it&#8217;s great to see all these excellent memes in one place. And I appreciate the links!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-1/#comment-238750</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Mon, 10 Aug 2009 16:32:55 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-238750</guid>
		<description>@Tetsuo: Noise with final is an issue, I&#039;ve seen that in many code reviews. As you say, I&#039;d wish it was default, and another modifier would make it not-final. 

Concerning the examples: There is a difference between example code that does want to show something, and real live code. The balance is fragile, between example code that is too simple and example code that is complex but doesn&#039;t show the things it should show.</description>
		<content:encoded><![CDATA[<p>@Tetsuo: Noise with final is an issue, I&#8217;ve seen that in many code reviews. As you say, I&#8217;d wish it was default, and another modifier would make it not-final. </p>
<p>Concerning the examples: There is a difference between example code that does want to show something, and real live code. The balance is fragile, between example code that is too simple and example code that is complex but doesn&#8217;t show the things it should show.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tetsuo</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-1/#comment-238717</link>
		<dc:creator>Tetsuo</dc:creator>
		<pubDate>Mon, 10 Aug 2009 15:55:38 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-238717</guid>
		<description>What is interesting is that you don&#039;t eat your own dog food. None of the code samples, besides #1 follows rule #1. Maybe because if you fill your declarations with &#039;final&#039; they will become less readable?

It would be great if Java had &#039;final&#039; enabled by default, or if it had a shorter way to declare it.

It would be greatest if the semantics of &#039;final&#039; were complete immutability, not just local variable immutability.

But Java isn&#039;t like that, and forcing things may be useful sometimes, but most of the time they will just add noise to the code.</description>
		<content:encoded><![CDATA[<p>What is interesting is that you don&#8217;t eat your own dog food. None of the code samples, besides #1 follows rule #1. Maybe because if you fill your declarations with &#8216;final&#8217; they will become less readable?</p>
<p>It would be great if Java had &#8216;final&#8217; enabled by default, or if it had a shorter way to declare it.</p>
<p>It would be greatest if the semantics of &#8216;final&#8217; were complete immutability, not just local variable immutability.</p>
<p>But Java isn&#8217;t like that, and forcing things may be useful sometimes, but most of the time they will just add noise to the code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-1/#comment-238709</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Mon, 10 Aug 2009 14:08:48 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-238709</guid>
		<description>@Antti: No, my error, changed, thanks :-)</description>
		<content:encoded><![CDATA[<p>@Antti: No, my error, changed, thanks :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-1/#comment-238705</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Mon, 10 Aug 2009 13:47:57 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-238705</guid>
		<description>@Mike: No, final does not make everything immutable. You need to have immutable containers and deep immutability.

No, for simple data holder, paramter objects and data transfer objects, encapsulation is not needed and the generated boiler code in Java is doing harm (if you need to look through 3 pages of source just to detect, it does nothing more than hold data). If encapsulation is needed later, refactor (Think DRY and premature optimization)</description>
		<content:encoded><![CDATA[<p>@Mike: No, final does not make everything immutable. You need to have immutable containers and deep immutability.</p>
<p>No, for simple data holder, paramter objects and data transfer objects, encapsulation is not needed and the generated boiler code in Java is doing harm (if you need to look through 3 pages of source just to detect, it does nothing more than hold data). If encapsulation is needed later, refactor (Think DRY and premature optimization)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: abby, the hacker chick blog</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-1/#comment-238698</link>
		<dc:creator>abby, the hacker chick blog</dc:creator>
		<pubDate>Mon, 10 Aug 2009 12:55:52 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-238698</guid>
		<description>Great post, thanks!</description>
		<content:encoded><![CDATA[<p>Great post, thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-1/#comment-238695</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Mon, 10 Aug 2009 12:54:01 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-238695</guid>
		<description>&gt; Another benefit is lower coupling
So you are for low coupling ...

&gt; This way the class is reusable
And reusability ...

&gt; Data Transfer Objects without setters and getters

But not for encapsulation?

I think you need to get your &lt;a href=&quot;http://72miles.com/blog/software-engineering-goals/&quot; rel=&quot;nofollow&quot;&gt;software engineering goals&lt;/a&gt; straightened out.</description>
		<content:encoded><![CDATA[<p>&gt; Another benefit is lower coupling<br />
So you are for low coupling &#8230;</p>
<p>&gt; This way the class is reusable<br />
And reusability &#8230;</p>
<p>&gt; Data Transfer Objects without setters and getters</p>
<p>But not for encapsulation?</p>
<p>I think you need to get your <a href="http://72miles.com/blog/software-engineering-goals/" rel="nofollow">software engineering goals</a> straightened out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-1/#comment-238694</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Mon, 10 Aug 2009 12:49:05 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-238694</guid>
		<description>&gt;Make everything immutable. 

Final does not make your entities immutable.</description>
		<content:encoded><![CDATA[<p>&gt;Make everything immutable. </p>
<p>Final does not make your entities immutable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Antti Mattila</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-1/#comment-238693</link>
		<dc:creator>Antti Mattila</dc:creator>
		<pubDate>Mon, 10 Aug 2009 12:39:57 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-238693</guid>
		<description>Is there some reason why example DTO in #8 has non final fields?</description>
		<content:encoded><![CDATA[<p>Is there some reason why example DTO in #8 has non final fields?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergio Bossa</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-1/#comment-238684</link>
		<dc:creator>Sergio Bossa</dc:creator>
		<pubDate>Mon, 10 Aug 2009 10:52:02 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-238684</guid>
		<description>Hi Stephan,

I agree with all points but #3 and #4.

More specifically, I agree with #3, only use with care: I&#039;d prefer not to introduce additional dependencies (as Google Collections) if I only have a bunch of (ugly) loops.

Regarding #4, I find one-line methods almost unreadable, and I still prefer to break them.

Other than that, I&#039;d sum up your most important advices as follows: think by interfaces, and always keep concurrency and side-effect-free in mind :)

Cheers,

Sergio B.</description>
		<content:encoded><![CDATA[<p>Hi Stephan,</p>
<p>I agree with all points but #3 and #4.</p>
<p>More specifically, I agree with #3, only use with care: I&#8217;d prefer not to introduce additional dependencies (as Google Collections) if I only have a bunch of (ugly) loops.</p>
<p>Regarding #4, I find one-line methods almost unreadable, and I still prefer to break them.</p>
<p>Other than that, I&#8217;d sum up your most important advices as follows: think by interfaces, and always keep concurrency and side-effect-free in mind :)</p>
<p>Cheers,</p>
<p>Sergio B.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Itay Maman</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-1/#comment-238681</link>
		<dc:creator>Itay Maman</dc:creator>
		<pubDate>Mon, 10 Aug 2009 10:35:55 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-238681</guid>
		<description>Also, this reminds me of Jeff Bay&#039;s &quot;Object Calisthenics&quot; essay (summarized here:
http://binstock.blogspot.com/2008/04/perfecting-oos-small-classes-and-short.html).</description>
		<content:encoded><![CDATA[<p>Also, this reminds me of Jeff Bay&#8217;s &#8220;Object Calisthenics&#8221; essay (summarized here:<br />
<a href="http://binstock.blogspot.com/2008/04/perfecting-oos-small-classes-and-short.html)" rel="nofollow">http://binstock.blogspot.com/2008/04/perfecting-oos-small-classes-and-short.html)</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Itay Maman</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-1/#comment-238678</link>
		<dc:creator>Itay Maman</dc:creator>
		<pubDate>Mon, 10 Aug 2009 10:26:16 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-238678</guid>
		<description>Great post. I think you managed to capture a trend that is alive and kicking and helps programmers be productive despite the fact that it is not emphasized (yet) in the text books, university courses, etc.


On top of this list, I think there is also &quot;the next generation patterns/designs&quot;. This list includes topics such as: DSLs, Dependency Injection, and the Properties Pattern (http://steve-yegge.blogspot.com/2008/10/universal-design-pattern.html).</description>
		<content:encoded><![CDATA[<p>Great post. I think you managed to capture a trend that is alive and kicking and helps programmers be productive despite the fact that it is not emphasized (yet) in the text books, university courses, etc.</p>
<p>On top of this list, I think there is also &#8220;the next generation patterns/designs&#8221;. This list includes topics such as: DSLs, Dependency Injection, and the Properties Pattern (<a href="http://steve-yegge.blogspot.com/2008/10/universal-design-pattern.html" rel="nofollow">http://steve-yegge.blogspot.com/2008/10/universal-design-pattern.html</a>).</p>
]]></content:encoded>
	</item>
</channel>
</rss>
