What does this mean. Don't write something like
public bool IsNotCorrect(...)
{
...
}
but rather write
public bool IsCorrect(...)
{
...
}
and the caller of the method then does the negation by calling it like
if(!IsCorrect(...)){
//do something
}
or
if(IsCorrect(...) == false){
//do something
}
as you prefer.
For instance consider the "pseudo-like-code" example
bool IsNotCorrect("today is Monday")
{
}
and in the program I want to check whether
today is Monday. So what I would have to write is
..
bool isMonday = !IsNotCorrect("today is Monday");
This is some kind of "double negation". The "IsNotCorrect(...)" will return "true" if today is NOT Monday, and false otherwise. Too complicated.
I mean this sounds somehow obvious to me and I guess a lot of people are doing this already without even thinking about it, but still I often see code written in this manner wherefore I guess it's worth mentioning.
Questions? Thoughts? Hit me up
on Twitter