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

Reply via email to