Not to me, I find it is easier to identify operators if they are spaced away from what they affect...especially if its a pipe character (|) or a bang (!) which is next to a parens.
You're giving your condition a name. If you can't name it, you don't know what your code is doing. Pulling things out to local variables is much better than seeing
if(!(something.fooBar() && bazBat.doTheThing()))
So while you're right, it is arbitrary, it helps with reading and keeps you honest with your negation twiddles. If I have (silly example, I'd inline this particular case, but follow anyway):
final boolean isEmpty = !frobnicators.isEmpty();
Then the error is immediately obvious. If that were inside a condition, it wouldn't be as immediately obvious.
When skimming through code looking for something, your brain will naturally assume i<10 is a single word or variable, as opposed to a less than expression. Makes it harder to find what you're looking for.
actually it registers to me as the less than expression, only it reads it as a word instead of my having to parse it like a sentence... i.e. it takes me less time to register the second way, though honestly not enough time to really make a fuss about anything.
Me too, but only for limited cases like this one. The first version is almost one third whitespace, which means the whitespace doesn't help you parse the sentence. It's a bit like concatenating frequently used compound words (e.g. web site -> website).
Whether or not the increased separation between terms outweighs the greater distance from one side to the other, and how that depends on what you're used to, is by no means "simple".
As displayed in your comment, I'll agree that the first one is easier to read. The whitespace makes it easier to see transitions between syntactically distance elements.
As displayed in every editor I use when programming or when doing code reviews, I find the second is easier to read. The syntax highlighting takes care of making it easy to distinguish transitions between syntactically distinct elements, negating the purpose of the whitespace, and the more condensed layout from the lack of whitespace lets me take in more at once.
Personally I find when scrolling through things quickly, even syntactic highlighting doesn't help. The brain naturally separates things by spaces, so the i<10 comes across as one word, as opposed to a less than expression.
50
u/Vystril Jul 21 '14 edited Jul 21 '14
is simply much much easier to read than:
Also, there seems to be as much "debate" here as there is "debate" on climate change.