Where can I learn more about simple programming conventions and design patterns?
When I say simple I mean which is the preferred way of writing the following equivalent functions:
function() {
if (condition) {
# condition wraps the entire function
}
}
or
function() {
if (!condition) {
return;
}
# rest of the function
}
There's also this:
function() {
$return_val = 'foo';
if (condition) {
$return_val = 'bar';
}
return $return_val;
}
vs this:
function() {
if (condition) {
return 'bar';
}
return 'foo';
}
Are these arbitrary differences or is are there established idioms for such things?