The negative conditionals in code blocks are most of the time difficult to read and understand.
It becomes worse when you make the conditionals anti-negative.
Before
Try to read above code snippets and try to understand it. Please note the highlighted parts. Does that code reads like
- When inverse of a package is not damaged then report an error: “Package is damaged”.
- When inverse of a package is not empty then report another error:
“Package is empty”
Ouch! Unreadable? Complex? Painful, isn’t it? Let’s revisit the same condition with positive conditionals.
After
Another example:
Before:
Above snippet is showing hours worked for the day if it’s not non-working day!
After
Now, this reads like simple statement. Show hours worked for working day.
