Re:The Hardest Program I've Ever Written
by philh on Thursday September 10, 2015 @09:04AM
(#10197753)
I'm not sure I like any of those as much as the original. When you introduce a new name, I don't know if you're going to use it anywhere else. (But having a name is good, so I'm on the fence.)
When all your while conditions are inside the block, I have to actually look at it to figure out that it's really just a standard while loop.
Re:The Hardest Program I've Ever Written
by ikurei on Thursday September 10, 2015 @04:52AM
(#10196870)
I agree with you in that multi-line conditionals should go, and no beautifier is going to make it up for bad code, but it's still great that they try. You can't always devote as much time as you'd like to make the code perfect, and that is when a beautifier comes the most handy. Also, having a good beautifier when you have to deal with other not-so-perfectionist programmer's code is great.
Either:
Or if you don't want to make up a good name for your conditional: Or, in a more rules-based fashion: I find it troubling to make up "good" indentation rules when the code to indent isn't well-written in the first place. Multi-line conditionals are an anti-pattern in itself (no matter if they appear in "while", "if" or "for").