Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hadoop >> mail # dev >> Re: Hadoop coding style guideline


Copy link to this message
-
Re: Hadoop coding style guideline
Aaron Kimball wrote:
> First, I've been picked on by others for using this brace style:
>
> if (foo) {
>   stmt;
> } else {
>   otherstmt;
> }
>
> and have been told to drop the braces because they look "ugly" if stmt or
> otherstmt are only one line.
>
> In http://java.sun.com/docs/codeconv/html/CodeConventions.doc6.html#449though,
> the sun coding conventions *clearly* say that braces are always to
> be used. Can we get a ruling here?

My preference is to permit both.  I like to maximize the amount of
readable logic per screen, and find that close braces around one-line
expressions don't improve readability (since indentation already
indicates the nesting) and decrease the amount of per-screen logic.
However I know reasonable people who prefer to always fully-bracket
their code.  I see no strong reason to force one style over the other.

> And second, what's our story on tabs vs. spaces?

Spaces are preferred, since tabs are inconsistently interpreted.  The
correct interpretation of a tab is to move to the next column evenly
divisible by 8, but many editors are configured differently, so tabs are
best avoided.

Doug
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB