Code Smell 51 — Double Negatives
Not operator is our friend. Not not operator is not our friend
- Name your variables, methods and classes with positive names.
This is a semantic smell. We need to detect it on code reviews.
We can tell linters to check for Regular Expressions like !not or !isNot etc as a warning.
Double negation is a very basic rule we learn as junior developers.
There are lots of production systems filled with this smell.
We need to trust our test coverage and make safe renames and other refactors.
Code Smell 07 — Boolean Variables
Using boolean variables as flag, exposes accidental implementation and pollutes the code with Ifs.
Code Smell 06 — Too Clever Programmer
Code difficult to read. Tricky with names without semantic. Sometimes using language’s accidental complexity.
What exactly is a name? — Part II: Rehab
We all agree: a good name is always the most important thing. Let’s find them.
Remove Double Negative
You have a double negative conditional. Make it a single positive conditional Double negatives are often frowned on by…
It’s harder to read code than to write it.
This article is part of the CodeSmell Series.