hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Bowen <dbo...@yahoo-inc.com>
Subject Re: [jira] Commented: (HADOOP-948) Coding style issues
Date Tue, 06 Feb 2007 17:31:32 GMT

> Irrational fear of a second return has lead to lots of unnecessary code branches, in
my experience. I'd rather see a return early in a function that a nested if branch that includes
the rest of the body of the function.
>   
I think it is entirely rational to avoid second returns.  (In cases
where there are a lot of early-exit tests, I would agree that multiple
returns are better than multiple nested if-then-elses.)  However, I
looked up the Sun Java coding conventions and found no mention of this,
so I don't know of any authority to which I can appeal to support my
case.  To me, code is more readily understandable if each unit has a
single exit point.



Mime
View raw message