<?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>Tue, 03 Jan 2012 15:08:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Gabriel C.</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-817086</link>
		<dc:creator>Gabriel C.</dc:creator>
		<pubDate>Tue, 03 Jan 2012 15:08:49 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-817086</guid>
		<description>I wonder why I got blocked in twitter for arguing in favor of #8: using JavaBeans style getters and setters most of the time is not needed and makes the code unnecessarily verbose, and even less OO, doing more harm than good. That&#039;s why I&#039;ve call it &quot;evil&quot; :)</description>
		<content:encoded><![CDATA[<p>I wonder why I got blocked in twitter for arguing in favor of #8: using JavaBeans style getters and setters most of the time is not needed and makes the code unnecessarily verbose, and even less OO, doing more harm than good. That&#8217;s why I&#8217;ve call it &#8220;evil&#8221; :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Emily S</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-572952</link>
		<dc:creator>Emily S</dc:creator>
		<pubDate>Sat, 09 Jul 2011 21:32:19 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-572952</guid>
		<description>I&#039;ve been developing in this style ever since I discovered Google Guava (&lt;3), one major thing I have started doing that you did not perhaps mention here is the idea of accessor classes.

I find myself often wanting a way to dynamically access a field in an object regardless of the object so I have started to do things like this; 
----------------
final class Person {
    String firstname;
    String surname;
    short age;
    Person mother;
    Person father

    public enum FatherAccessor implements Function {
        instance;
        public Person apply(Person input) {
            return input.father;
        }
    }
}
-------------
Obviously this is a simple example but its served us well. This style of programming allows you to produce a &#039;view&#039; of an underlying collection regardless of where and what it is, eg;

Set people = getPeople();

Iterable father = Iterables.transform(people,Person.FatherAccessor.instance);</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been developing in this style ever since I discovered Google Guava (&lt;3), one major thing I have started doing that you did not perhaps mention here is the idea of accessor classes.</p>
<p>I find myself often wanting a way to dynamically access a field in an object regardless of the object so I have started to do things like this;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
final class Person {<br />
    String firstname;<br />
    String surname;<br />
    short age;<br />
    Person mother;<br />
    Person father</p>
<p>    public enum FatherAccessor implements Function {<br />
        instance;<br />
        public Person apply(Person input) {<br />
            return input.father;<br />
        }<br />
    }<br />
}<br />
&#8212;&#8212;&#8212;&#8212;-<br />
Obviously this is a simple example but its served us well. This style of programming allows you to produce a &#8216;view&#8217; of an underlying collection regardless of where and what it is, eg;</p>
<p>Set people = getPeople();</p>
<p>Iterable father = Iterables.transform(people,Person.FatherAccessor.instance);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jbee</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-332498</link>
		<dc:creator>jbee</dc:creator>
		<pubDate>Mon, 27 Sep 2010 08:00:04 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-332498</guid>
		<description>I agree conceptual with all except the one-liner formatting. Especially #3 was ignored too long. But I really dislike the way you advice the apply em. Static helper functions for collections are more or less part of our (java world) problem. So... to make it right switch to a collection API that supports such operations as e.g. list operation: Than this would read like that:

  List beerDrinkers = persons.filter(both(canDrinkBeer, isMale));

both is a helper Method to combine predicate functions to a new one where both has to be fulfilled. 

I think that&#039;s the way the code should look like.</description>
		<content:encoded><![CDATA[<p>I agree conceptual with all except the one-liner formatting. Especially #3 was ignored too long. But I really dislike the way you advice the apply em. Static helper functions for collections are more or less part of our (java world) problem. So&#8230; to make it right switch to a collection API that supports such operations as e.g. list operation: Than this would read like that:</p>
<p>  List beerDrinkers = persons.filter(both(canDrinkBeer, isMale));</p>
<p>both is a helper Method to combine predicate functions to a new one where both has to be fulfilled. </p>
<p>I think that&#8217;s the way the code should look like.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-328726</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Fri, 17 Sep 2010 15:11:29 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-328726</guid>
		<description>Good post, I essentially agree with it all. I&#039;ve never understood why most Java programmers like to write the most verbose code they can? Finger exercise maybe?</description>
		<content:encoded><![CDATA[<p>Good post, I essentially agree with it all. I&#8217;ve never understood why most Java programmers like to write the most verbose code they can? Finger exercise maybe?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-315666</link>
		<dc:creator>Will</dc:creator>
		<pubDate>Mon, 16 Aug 2010 20:02:53 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-315666</guid>
		<description>Great post. A couple of comments: 

1) you&#039;re going to have a loop somewhere one way or another (e.g. inside the filter method), but I absolutely agree that the closer you can get to a functional style, the better.  

2) One liners... use with caution.  Even trivial things can be easier to step through in a debugger if you have the calculation separated out line by line.  Also, you&#039;re not going to gain much efficiency by compressing something like your example add method.</description>
		<content:encoded><![CDATA[<p>Great post. A couple of comments: </p>
<p>1) you&#8217;re going to have a loop somewhere one way or another (e.g. inside the filter method), but I absolutely agree that the closer you can get to a functional style, the better.  </p>
<p>2) One liners&#8230; use with caution.  Even trivial things can be easier to step through in a debugger if you have the calculation separated out line by line.  Also, you&#8217;re not going to gain much efficiency by compressing something like your example add method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fluent Interfaces for Searching Hibernate Entities &#171; IT Developer World</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-312922</link>
		<dc:creator>Fluent Interfaces for Searching Hibernate Entities &#171; IT Developer World</dc:creator>
		<pubDate>Sat, 07 Aug 2010 01:59:06 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-312922</guid>
		<description>[...] setter for collections, make the getter return an immutable list and added an addSomething method (all following further good practices that were also on Code Monkeyism). Project development went on then we hit the point in where we needed to develop our entity search [...]</description>
		<content:encoded><![CDATA[<p>[...] setter for collections, make the getter return an immutable list and added an addSomething method (all following further good practices that were also on Code Monkeyism). Project development went on then we hit the point in where we needed to develop our entity search [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-308639</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Thu, 22 Jul 2010 08:22:06 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-308639</guid>
		<description>@Rick: Thx

@Jan Wilem: Scala has changed me too, although my Java was very functional, pragmatic and non-mainstream already.</description>
		<content:encoded><![CDATA[<p>@Rick: Thx</p>
<p>@Jan Wilem: Scala has changed me too, although my Java was very functional, pragmatic and non-mainstream already.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick van der Arend</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-308635</link>
		<dc:creator>Rick van der Arend</dc:creator>
		<pubDate>Thu, 22 Jul 2010 08:06:01 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-308635</guid>
		<description>Nice post, clear explanations and argumentation.</description>
		<content:encoded><![CDATA[<p>Nice post, clear explanations and argumentation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan Willem Tulp</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-308632</link>
		<dc:creator>Jan Willem Tulp</dc:creator>
		<pubDate>Thu, 22 Jul 2010 07:58:28 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-308632</guid>
		<description>Great post, and it seems like I&#039;m already doing most of this stuff. And for me also, working in Scala has changed my Java programming style (for the better! :))</description>
		<content:encoded><![CDATA[<p>Great post, and it seems like I&#8217;m already doing most of this stuff. And for me also, working in Scala has changed my Java programming style (for the better! :))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-308601</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Thu, 22 Jul 2010 04:24:58 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-308601</guid>
		<description>@Pascal-Louis Perez: Wow, kaChing, you&#039;re my heros, I hope we can move to your devops style  and to continuous deployments.

I might think that predicats are just that, predicates. And expresses as functions in FP languages and objects in OO languages. But even in FP languages they are manifestations, not functions per se.

Stephan
Vice CTO - brands4friends</description>
		<content:encoded><![CDATA[<p>@Pascal-Louis Perez: Wow, kaChing, you&#8217;re my heros, I hope we can move to your devops style  and to continuous deployments.</p>
<p>I might think that predicats are just that, predicates. And expresses as functions in FP languages and objects in OO languages. But even in FP languages they are manifestations, not functions per se.</p>
<p>Stephan<br />
Vice CTO &#8211; brands4friends</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pascal-Louis Perez</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-308475</link>
		<dc:creator>Pascal-Louis Perez</dc:creator>
		<pubDate>Wed, 21 Jul 2010 20:26:50 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-308475</guid>
		<description>Great post. Music to our ears here at kaChing ;)

I do not agree with you that predicates is OO. Rather they are the natural way to express a function T -&gt; bool in an OO language. If you think of how closures work (i.e. closed functions with stack plus code) they are essentially an object passed around. In that sense, they are very close to what a predicate does.

Pascal-Louis Perez
CTO - kaChing</description>
		<content:encoded><![CDATA[<p>Great post. Music to our ears here at kaChing ;)</p>
<p>I do not agree with you that predicates is OO. Rather they are the natural way to express a function T -&gt; bool in an OO language. If you think of how closures work (i.e. closed functions with stack plus code) they are essentially an object passed around. In that sense, they are very close to what a predicate does.</p>
<p>Pascal-Louis Perez<br />
CTO &#8211; kaChing</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Good tips for OO developers &#171; a developer&#8217;s breadcrumb</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-291679</link>
		<dc:creator>Good tips for OO developers &#171; a developer&#8217;s breadcrumb</dc:creator>
		<pubDate>Mon, 17 May 2010 06:53:04 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-291679</guid>
		<description>[...] source: Go Ahead: Next Generation Java Programming Style [...]</description>
		<content:encoded><![CDATA[<p>[...] source: Go Ahead: Next Generation Java Programming Style [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Det</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-286083</link>
		<dc:creator>Det</dc:creator>
		<pubDate>Fri, 23 Apr 2010 14:57:13 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-286083</guid>
		<description>@Jaroslaw Dobrzanski - August 12th, 2009 
&quot;Now, I wouldn’t agree ‘Use one liners’ 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;
}&quot;

AND 

@ Ignacio Coloma - August 11th, 2009 
&quot;#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.&quot;

The problem here is the &quot;expected&quot; vertical rhythm. In the western world, we write from left to right. Even mathematical formulas are from left to right. You would not find a mathematician writing

y =
f(x)

f(x) 
=
x**2
+
2x
+
5

Therefore, the overdone vertical writing style is already &quot;unnatural&quot;, but conditioned over a long time of simply doing it, and perhaps a relict of the assembler times, where code was read in columns.

At the time you get used to grok such one-liners as &quot;expressions&quot;, like a formula in math, it feels uncomfortable to have such simple expressions artificially split. This splitting of even the simplest expressions is again an artefact of the verbosity of Java.

See:
public int add(int a, int b) { return a + b; }

as:

int add(int a, int b) = { a + b}

or even:

add(a, b) = a + b

The problem is, that all the boilerplate makes it hard to find the elementary things, so you &quot;emphasize&quot; them by putting each on an own line. 

NB:
Another old generation style is, to write all attributes at the beginning of a class and getter and setter below, sometimes sorted in all getters and all setters apart.

This style feels like the very old Cobol days with its different sections.

A NG style I sometimes use is, to group the property parts together:

private String name;
public  String getName()             { return name; }
public  void   setName(String pName) { name = pName }</description>
		<content:encoded><![CDATA[<p>@Jaroslaw Dobrzanski &#8211; August 12th, 2009<br />
&#8220;Now, I wouldn’t agree ‘Use one liners’ 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 />
}&#8221;</p>
<p>AND </p>
<p>@ Ignacio Coloma &#8211; August 11th, 2009<br />
&#8220;#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.&#8221;</p>
<p>The problem here is the &#8220;expected&#8221; vertical rhythm. In the western world, we write from left to right. Even mathematical formulas are from left to right. You would not find a mathematician writing</p>
<p>y =<br />
f(x)</p>
<p>f(x)<br />
=<br />
x**2<br />
+<br />
2x<br />
+<br />
5</p>
<p>Therefore, the overdone vertical writing style is already &#8220;unnatural&#8221;, but conditioned over a long time of simply doing it, and perhaps a relict of the assembler times, where code was read in columns.</p>
<p>At the time you get used to grok such one-liners as &#8220;expressions&#8221;, like a formula in math, it feels uncomfortable to have such simple expressions artificially split. This splitting of even the simplest expressions is again an artefact of the verbosity of Java.</p>
<p>See:<br />
public int add(int a, int b) { return a + b; }</p>
<p>as:</p>
<p>int add(int a, int b) = { a + b}</p>
<p>or even:</p>
<p>add(a, b) = a + b</p>
<p>The problem is, that all the boilerplate makes it hard to find the elementary things, so you &#8220;emphasize&#8221; them by putting each on an own line. </p>
<p>NB:<br />
Another old generation style is, to write all attributes at the beginning of a class and getter and setter below, sometimes sorted in all getters and all setters apart.</p>
<p>This style feels like the very old Cobol days with its different sections.</p>
<p>A NG style I sometimes use is, to group the property parts together:</p>
<p>private String name;<br />
public  String getName()             { return name; }<br />
public  void   setName(String pName) { name = pName }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Timo Westkämper</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-284136</link>
		<dc:creator>Timo Westkämper</dc:creator>
		<pubDate>Fri, 16 Apr 2010 07:01:21 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-284136</guid>
		<description>Great post! For us at Mysema new Java programming style is also very much about type-safety. To promote type-safety with database queries we offer our own LGPL licensed query layer : http://source.mysema.com/display/querydsl/Querydsl

Querydsl supports JPA, JDO, SQL, Lucene, Java collections and RDF.

So instead of inline strings you can use fluent type-safe Java calls.</description>
		<content:encoded><![CDATA[<p>Great post! For us at Mysema new Java programming style is also very much about type-safety. To promote type-safety with database queries we offer our own LGPL licensed query layer : <a href="http://source.mysema.com/display/querydsl/Querydsl" rel="nofollow">http://source.mysema.com/display/querydsl/Querydsl</a></p>
<p>Querydsl supports JPA, JDO, SQL, Lucene, Java collections and RDF.</p>
<p>So instead of inline strings you can use fluent type-safe Java calls.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: busana muslim</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-283170</link>
		<dc:creator>busana muslim</dc:creator>
		<pubDate>Mon, 12 Apr 2010 08:15:26 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-283170</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 “Effective Java/Joshua Block” book.</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 “Effective Java/Joshua Block” book.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Newsletter KW14 / 2010</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-282066</link>
		<dc:creator>Newsletter KW14 / 2010</dc:creator>
		<pubDate>Wed, 07 Apr 2010 20:10:38 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-282066</guid>
		<description>[...] Was kann man tun, um den &#8216;altbackenen&#8217; Programmierstil in Java zu verbessern? Ein paar Ideen und Kommentare aus einem [...]</description>
		<content:encoded><![CDATA[<p>[...] Was kann man tun, um den &#8216;altbackenen&#8217; Programmierstil in Java zu verbessern? Ein paar Ideen und Kommentare aus einem [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zainul Franciscus</title>
		<link>http://codemonkeyism.com/generation-java-programming-style/comment-page-4/#comment-280206</link>
		<dc:creator>Zainul Franciscus</dc:creator>
		<pubDate>Tue, 30 Mar 2010 18:46:04 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=997#comment-280206</guid>
		<description>Interesting coding style. I am a java developer myself. I am quite concern to hear that people are moving out from java to other languages. Java is a great language, yes it can be too noisy and over bloated to many people. But they have a strong presence in enterprises and a strong open source community backing them. I hope to see more improvement in the future for java.</description>
		<content:encoded><![CDATA[<p>Interesting coding style. I am a java developer myself. I am quite concern to hear that people are moving out from java to other languages. Java is a great language, yes it can be too noisy and over bloated to many people. But they have a strong presence in enterprises and a strong open source community backing them. I hope to see more improvement in the future for java.</p>
]]></content:encoded>
	</item>
	<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>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk (user agent is rejected)
Database Caching 4/57 queries in 0.228 seconds using disk

Served from: codemonkeyism.com @ 2012-02-04 07:13:34 -->
