dev@glassfish.java.net

Re: Implementation Improvements in Entity-Persistence

From: Jakub Podlesak <Jakub.Podlesak_at_Sun.COM>
Date: Tue, 03 Oct 2006 13:37:24 +0200

Hi Markus,

just a comment on (5). Please see document at
http://java.sun.com/docs/codeconv/CodeConventions.pdf

By omitting brackets in such a code you just make the code
shorter, but certainly not better for reading, in spite what you wrote.
And you also introduce a place for potential bug.
Consider somebody wants to add a new line to such single line statement.
If there are no brackets, he/she needs to add them as well, what
could be a problem.... and it could be very easy to oversee
missing brackets e.g where comments are heavily used.

Have a nice day and good luck

~Jakub



On Tue, Oct 03, 2006 at 12:37:51PM +0200, Markus KARG wrote:
>
> (5) Do you think, Single Line Blocks are too short?
>
> Don't you like the shortness of single line blocks? Or are we all Java
> beginners? ;-) Otherwise I cannot understand why you keep writing the
> ending bracket in single-line blocks (e. g. FORs and IFs). This makes
> the code harder to read and longer than needed. Java allows omitting
> trailing brackets in single line blocks by intention, not by fault. ;-)
>
>