Put statements in positive form

How often have you seen code where the absence of something is negated? Sounds confusing, because it is.

Here's an example, assuming a config object with some properties, the value for disableSomething is a boolean:

!config.disableSomething

That result of that line will be true if disableSomething is false. Used as a condition, we would be doing something if this config property is not disabled. Wouldn't it be better to say enable? It seems like a minor point, but this type of double negative increases complexity and likelihood of a misunderstanding when a positive equivalent will do. A positive form is simpler to process (for a programmer, not necessarily for a computer): use enableSomething instead of disableSomething.

Disable/enable are a common pair, but nearly as common, at least when dong frontend work, is show/hide. Much as I prefer to say something is enabled, I much prefer to say show instead of hide.

A section from Strunk & White's The Elements of Style is titled "Put Statements in a Positive Form". That perfectly summarizes the point I'm making. The Elements of Style applies to programming too!

Much like writing in general, the rule of thumb should be to opt for the positive form rather than the negative. Saying something is "enabled" is positive, it conveys the existence of something. Saying something is "disabled" is negative. We are talking about the absence of something. Please avoid the negative form and the double negatives.