|
|
|
|
|
by chton
4082 days ago
|
|
My pleasure. One thing I forgot to mention is that I try to never use negatives in boolean names, both for methods and variables. The moment you start with "IsNotXXX" or "HasNoXXX", you're creating a new way to potentially confuse future readers. If you can, always try to find a positive way of expressing the same, it'll usually be less ambiguous. If it really is necessary to express a negative, perhaps because the reverse is too broad or hard to formulate, it's usually better to invert the meaning of the boolean entirely. So instead of if(IsNotFoo) {}
you can do if(!IsFoo) {}
It's a simple thing, but it can save you valuable time and brainspace at some point in the future. |
|