On Wednesday, 27 December 2017 at 20:48:12 UTC, Walter Bright wrote:
On 12/27/2017 8:38 AM, Laeeth Isharc wrote:
On Wednesday, 27 December 2017 at 07:44:30 UTC, Walter Bright wrote:

The psychological cognitive issues around negation are known, but I rarely see deliberate efforts by programmers to deal with that issue. D kinda forces it, and I get resistance to it, but it is worthwhile to push it because the results are worth it.

I nearly always reorganise my code so that my `if` statements are positive precisely because of this. The only times I don't is when the negative branch is a lot shorter, so I "get it out of the way" sooner. Even then I try to rename the boolean value to not require negation.

I had a hard time convincing my colleagues at my previous job that this was an issue. Then again I had a hard time convincing them unit tests were a good idea, so there's that.

Atila

Reply via email to