During code review I discovered many places of our C# code that looks like this:
if(IsValid()) {
return true;
}
else {
return false;
}
or even "better":
return (IsValid()? true : false);
I always wondered why not just write the code like this:
return IsValid();
This is the way I would write this code. I ain't questioning the skills of the developers, but maybe trying to look into the developer's soul. Why would a developer favor more complex code and not a more simple and intuitive? Or maybe the reason is that it is hard to accept the Boolean type as the first-class citizen?