The important thing about using the SAME style is that if I am extending
someone else's code in the same project (e.g. adding an additional else
if clause) that when I do a diff I can see oh I just added a diff
clause, rather than, oh there are abunch of whitespace changes so I
really have no way of seeing what has changed other than look through
line by line. I use auto format a lot which means that it is difficult
to find the real changes when there was not consistent formatting.
Paul
P.Rizzi Ag.Mobilità Ambiente wrote:
Yes, but I don't believe that would add anything to readability...
I think the key is not about everybody using the same style,
but about each one using a "consistent" style.
If one always use the same style, even a non-programmer it's perfectly
able
of understanding it after a couple of example, because it's always the
same.
And even when different people works upon the same code, I don't think
it's
a bad thing if each one uses it's own style, so diferent pieces of
code can be
easily spotted.
But this is just me... :-)
Bye
Paolo Rizzi
-----Messaggio originale-----
*Da:* [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] conto
di *Paul Austin
*Inviato:* mercoledì 2 luglio 2008 18.59
*A:* OpenJump develop and use
*Oggetto:* Re: [JPP-Devel] R: Style Sheet For Java FOSS Coding
On another note all blocks should use {}, spaces instead of tabs.
2 spaces is the perfect amount of indent.
void mmm(int i, String[] sss) {
if (i < 0) {
i = 0;
}
if (sss == null) {
sss = new String[0];
}
}
P.Rizzi Ag.Mobilità Ambiente wrote:
I use the ?: a lot!!!
I agree that an if/else is more readable, but in some situations the ?: is
better.
For example I use it to "normalize" method parameters:
void mmm(int i,String[] sss)
{
i = i < 0 ? 0 : i;
sss = sss == null ? new String[0] : sss;
...
}
The above is much more concise than:
void mmm(int i,String[] sss)
{
if( i < 0 )
i = 0;
if( sss == null )
sss = new String[0];
}
and I don't find it any less readable...
Sure enough in other cases an if/else is much better!!!
Bye
Paolo Rizzi
-----Messaggio originale-----
Da: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
conto di Paul
Austin
Inviato: mercoledì 2 luglio 2008 18.35
A: OpenJump develop and use
Oggetto: Re: [JPP-Devel] Style Sheet For Java FOSS Coding
I think that using an if/.else statement is much more
readable than the
?: operator.
It's just another one of those coding religious wars such as if the {
should be on the same or the next line.
Paul
--------------------------------------------------------------
-----------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
------------------------------------------------------------------------
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
------------------------------------------------------------------------
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel