but I feel it is not readable as I have never used this before (and
nobody teached me this). And it is especially a disadvantage for
beginners in programming. [so "concise" for whom?]
Please guys, stick to the long but readable version if you write public
code.
my 2 cents
Stefan
PS: this reminds me a bit in an old presentation where somebody made a
joke how unreadable C code can be using several symbols.
P.Rizzi Ag.Mobilità Ambiente schrieb:
> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel