A nitpick reads something along the lines of: Avoid using a not (!) and an else in the same statement...Test for == and swap your if and else blocks.
Now, I'm aware of this rule of thumb, but I've also heard that it's better to put the expected result first and the exception in the else block. So, in the case of checking for failed method I might do something like:
In this case the normal and expected result of my method is to return a non-null result and keep on truckin'.
So my question is: which is easier to read?
1) eliminate the not (!) and swap the if and else blocks
or
2) keep the not (!) and put the expected/normal case first (as I've shown in the example)
And, are there any cases where using not (!) and else together makes sense from a readability standpoint?
Cheers,
Sam