Thursday, February 2, 2017

get offa my lawn grumbling about new school linting

From some Slack chat to a fellow "veteran" coder at work:

One paradigm that I think makes sense, but goes against some of the same feelings of "self-evident good" shibboleths as "triple equals" - personally I'd rather be allowed to say
if(something) doOneThing();
as long as that was one line, it's like a single thought. Or even
if(something) doOneThing();else doAnother();
Most of the arguments that insist on the curly brace frame arguments like "well what if you put in another command, and expected it to be conditional, but it wasn't?" but that would only apply if someone was doing
if(something)   doOneThing();
which to me is clearly wrong.

But people prefer the simplicity of the "always use brackets" rule, so that two liner example above will be 5 or 6 (depending on if you can "} else {" on one line, and it's not THAT big a loss, but still.

It's the principle of over-simplified linting rules that get to wear the cloak of "this is obviously better, you cave man graybeard" that bugs me a little -- again ala "triple equals is ALWAYS better" even for edge cases where it's demonstrably not.

(The fellow coder said he had been burnt by this after using the "to me clearly wrong" example of putting the conditional'd action on the next line line without braces, just indenting... so maybe we should just stick to braces everywhere, sigh.)

No comments:

Post a Comment