2 ms·
I think the point OP’s trying to make is that reducing indentation levels makes code more readable. I don’t agree with him about removing the braces, though. T
by moomin 9y ago
I think the point OP’s trying to make is that reducing indentation levels makes code more readable.
I don’t agree with him about removing the braces, though. That way madness lies.
- thomasahle 9y agoThis particular refactor (changing `if (err) { return ... }` to `if (err) return ...`) didn't actually reduce indentation levels though. It only reduced the number of lines.
- moomin 9y agoYeah, I’ll file that under “maybe don’t do that”.
- timoxley 9y agowhat are the downsides
- 84Winston 9y agoremoving "unnecessary" {}? potential disaster. http://heartbleed.com/ http://heartbleed.com/
- moomin 9y agoIn general terms, in C-like languages, mixing braces and semi-colons is horribly refactor unfriendly and bug prone. Meanwhile, sticking things on one line introduces a cognitive load that you might not want. (YMMV on the second point, but I’ve pretty strong views on the first.)