Redundant code constructs
coding-style
Solution
if (foo == true)
{
do stuff
}
I keep telling the developer that does that that it should be
if ((foo == true) == true)
{
do stuff
}
but he hasn't gotten the hint yet.
Problem
The most egregiously redundant code construct I often see involves using the code sequence ``` if (condition) return true; else return false; ``` instead of simply writing ``` return (condition); ``` I've seen this beginner error in all sorts of languages: from Pascal and C to PHP and Java. What other such constructs would you flag in a code review?