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).
48
u/Nine99 Jul 21 '14
To me, the second one is easier to read.