On Dec 13, 2010, at 9:48 AM, Rupert Westenthaler wrote:

> Hi all,
> 
> no vote yet, but let me add some comments:
> 
> Line length (section Sun code conventions 4.1)
> 
> I would suggest to exclude this point and allow longer lines than 80
> chars. The argument about terminals is no longer valid nowadays and
> with typical screen resolutions even lines with 150 chars do fit well.

On my 13'' Mac Book, which is a pretty standard machine nowadays, using IDEA as 
my IDE, with a standard font site, I have about 120 horizontal characters in 
the editor windows (when the left navigation panel is open, which for me is all 
the time), not 150.

> Especially breaking up long log messages into several lines makes the
> code much harder to read in my opinion.

I don't agree with this statement. 

Long established typographical knowledge (based on empirical evidences) 
suggests lines should be around 50 to 60 characters long, maximum 70, for 
maximal readability.

See for instance:

http://baymard.com/blog/line-length-readability

and the references given therein.

So the old-time recommendation for using 80 characters wide lines (which was 
mandated by the use of obsolete computer equipment such as the Teletype or 
VT-100 terminal) still makes sense. This is specially true for logging messages 
that should be treated as regular text, here obey the rule of typography.

I agree that forcing Java code to be 80 characters wide can lead to something 
that's unappealing, specially when you have long method names, and using 
generics.

OTOH, if you end up with lines too long to fit into 80 characters, it can mean 
that:

- you're using too nested for / while / if statements, that should be 
decomposed into smaller methods (see for instance Clean Code by Bob Martin, 
http://en.wikipedia.org/wiki/Special:BookSources/0132350882 ).

- you're using too complex expressions, that should be decomposed in simpler 
expressions with additional variables (same reference).


To summarize, I think we should treat 80 characters as a "soft" limit (i.e. we 
should *try* to fit our code into 80 characters) and 120 (not 150!) as a "hard" 
limit, except for very special cases (i.e. code that's not supposed to be read 
at all).

> Intend size
> 
> I have done some testing based on the suggested code formatter
> configuration. In general the  4 spaces intend works best for simple
> code segments while the 2 spaces indent feels better for more complex
> parts with a lot of hierarchy levels.

As I wrote above, if indentation leads to too long lines, it means that you 
have too nested for / while / if statements that need to be decomposed for 
maximal readability and understability.

> As long we do not stick to the 80 char line length I do not have any
> preference. In case we decide to respect the 80 char line length I do
> have a strong preference for using only 2 space intends.
> 
> License Headers
> 
> A short google search for "mvn plugin license" showed up several
> options for plugin that are able to manage license headers. I suggest
> to use one of those.


I'm sure Bertrand knows the best one to use :)

  S.

--
Stefane Fermigier, Founder and Chairman, Nuxeo
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com/ - +33 1 40 33 79 87 - http://twitter.com/sfermigier
Join the Nuxeo Group on LinkedIn: http://linkedin.com/groups?gid=43314
New Nuxeo release: http://nuxeo.com/dm54
"There's no such thing as can't. You always have a choice."

Reply via email to