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?
Another way to look at it is that you are getting the off case out of the way up front.
This is a topic that can be at the heart of some mild debate. Kinda like "top down" vs. "bottom up."
Since the camps are generally evenly divided about "do happy path first" vs. "get the odd ducks out of the way first", and everybody can agree on simplifying code ... I think that what your nitpicker is suggesting is generally the best route.
Make no mistake - this is more of a guideline than an absolute. Readability is always king. And there are limitations to the english language.