I used to work at a company that had a policy of using the first method. ie of leaving off the
else. (They did code reviews.) It was claimed that this lead to more "linear" flow rather than deeply nested flow.
The idea is that the example
if block is checking for (and dealing with) an exceptional situation. That check/deal step is a logical unit with respect to whatever the code it is part of is trying to accomplish.
Once that check/deal step is done the program continues on with the next step. Including an
else clutters the code and slightly hides the main focus of the code.
Another effect of using
else where it is not needed is it increases the level of nesting. That often makes code harder to understand.
The company also had commenting standards so the code might look something like the following.
GOAL means "something we want to do".
CLAIM means "something that is true at this point in the code".
my $name = param("name");
# GOAL : ensure input values are valid
if ($name eq "")
{
print qq(Sorry, name can't be empty);
exit;
}
# CLAIM : all input values are valid
# GOAL : process input values
print "Thank you, $name. Your submission is complete.";