I'm learning about how to create a good and clean code. I just need to review something like that, and I really not sure how can I fix this code into a clean code.
bool isValidUserName(const std::string& username)
{
bool valid = false;
if (username.length() >= MIN_NAME_LENGTH)
{
if (username.length() <= MAX_NAME_LENGTH)
{
if (isalpha(username[0]))
{
bool foundNotValidChar = std::find_if(username.begin(), username.end(), isNotValid) != username.end();
if (!foundNotValidChar)
{
valid = true;
}
}
}
}
return valid;
}
thank you very much!, i replied lately because i had to do something and i forgot about it already
{}
start to look like an arrow head (a triangle). For example, Jeff Atwood blogged about the arrow anti-pattern a while ago. \$\endgroup\$