News for hackers. Stuff that matters.
Re:Avoid Else, Return Early (2013) by JoeAltmaier on Monday March 26, 2018 @10:33AM (#16679171)
That link's favorite response actually refutes that brace style matters at all. No correlation with bug frequency detectable. So its all religion.
Re:Avoid Else, Return Early (2013) by ergothus on Monday March 26, 2018 @11:47AM (#16679727)
I wish this sentiment were expressed more often but also expressed less judgmentally and given more depth than sometimes occurs..

To say it is religion isn't to say "your preference is dumb". In my own code preferences I try to maintain a split between "have a reason I have confidence in" and "personal preference". And "easier to read" is almost always in the latter. (If you can say WHY, that is the actual reason, but your actual reason still has to be provable.)

Given the difficulty of finding good research and the inherent difficulty of the research (if familiarity is a big component to preference, and a proven ability to mentally parse code required to judge, then good luck running a control group) I have a lot of items I have confidence in being provable without having actual proof, but the lengthy preference list also means I'm willing to accept that each of those can switch columns.

Way too many of our "easier to read" defenses are really "it is easier to read because I'm familiar with it. I personally think camelCase is terrible - language has spaces for reasons! - but there is no denying that it is very common and that the vast majority of coders learned it first, an unfortunate self perpetuating cycle.

Nonetheless, shown research that said I was wrong (assuming said research had taken familiarity into account) I would change my stance rather than dig in my heels...even if that change were to only add "but that's just me" to the end of it.

Re:Avoid Else, Return Early (2013) by RobertRoberts on Monday March 26, 2018 @11:00AM (#16679389)
It's not "religion" if there's a technical reason to choose one method over another.

A later comment on the SO post described how K&R can have maintenance costs because when moving things around it's more difficult to tell where a statement ends, and can accidentally cause side effects.

Re:Avoid Else, Return Early (2013) by JoeAltmaier on Monday March 26, 2018 @12:16PM (#16679971)
Not reflected in the bug statistics, according to the post. So if the effects exists, its negligible.
Re:Avoid Else, Return Early (2013) by RobertRoberts on Monday March 26, 2018 @01:16PM (#16680580)
>So if the effects exists, its negligible.

The only thing being considered was "bugs in the final code", not "time and effort in maintenance."