OK I apologize for the aggression but I’m not backing off n returns.

When you use phrases like “excessive indentation” it makes me wonder. Clearly laid-out scoping is clearly readable code and I don’t mind indenting ten levels, though I am likelier to break up the function first. I’d rather indent twenty level than use an early return.

I’ve been responsible for coding standards in many groups and no early returns is an unconditional rule. I believed I gave the reason for the three (3) I’ve used in a quarter century.

But theres more. Look at the code of anyone who uses these routinely and if he comments then the one above the return is bund to include

// … so just get out.

It’s not just the misplaced exit; it’s the thinking that underlies it, the joy of defeat, giving up at first opportunity. It’s never anyone’s solitary sloppy habit, it’s one of a syndrome of sloppy habits. I want to discourage sloppy habits.

Yes some people can use them carefully, Agree. I won’t. But then morons come along, read the code, see the careful usage as global endorsement, and use them everywhere, just like throw.

This is an argument as old as software. This is why I gave up Smalltalk. I guess it means I won’t do much in Go. I’m not going to change your mind; you certainly aren’t going to change mine.

But, I mean, really. “Excessive indentation?”

Written by

American Software Developer living in Vietnam. Classical musician (guitar, woodwinds), weightlifter, multilingual, misanthrope • XY

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store