On 09.07.2015 11:39, David Bosschaert wrote:
I like the idea of having code formatting rules too. Just a couple of
thoughts from my side:
* I hate tabs too
I think we all agree on spaces over tabs and probably also to use 4
spaces per indent level.
* Line length should be at least 128 or more
~130 sounds like a good length to me too.
* I dislike curlies on a separate line (like is done in some projects)
as it wastes space IMHO. I prefer them at the end of the current line
(open) and start of the line (close). This is pretty much the way it
is done in general in Aries right now.
I also used to like the curlies on the same line to save vertical space.
Unfortunately
it does not work well with the better indenting for method parameters.
If you put the method parameters in a new line and indent them then they
are at the same
level like the method calls inside myMethod. So it is too easy to
confuse parameters and method calls.
public void myMethod(
String first, String second) {
someCode(
first, second);
}
If you do the curlie brace in a new line it separates the parameters
from the method calls inside:
public void myMethod(
String first, String second)
{
someCode(
first, second);
}
So I think the curly braces rule is connected to the indent style for
parameters.
If we indent Parameters like in CXF then the curly braces on the same
line are good.
If we indent Parameters one level in a new line then curly braces should
also be in a new line.
I prefer the second style but can also live with the cxf one.
Christian
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
http://www.talend.com