clean_code.htm
Notes on Clean Code
Subjects
Function Length
...
Single Responsibility Principle
...
Avoiding Complex Booleans
Source: Google Testing Blog Avoid complex booleans, encapsulate them as functions or variables whenever possible.
BAD: spelled out
// Decide whether this pizza is fantastic.
if ((!pepperoniService.empty() || sausages.size() > 0)
&& (useOnionFlag.get() || hasMushroom(ENOKI, PORTOBELLO)) && hasCheese())