Tradition vs Logic

Thinking a bit more about those hard to break habits of code, it really got me to thinking about why some habits, or really traditions, are so hard to break. Some of those traditions include:
The PrivateInstanceVariableMandate, discussed earlier.
Then there’s the SingleReturnStatement which enforces the following:


function boolean foo(int args) {
int result = -1;
if(0 != args) {
...do something...
}
return -1;
}

which can really be simplified:


function boolean foo(int args) {
if(0 == args)
return -1;
...do something...
return result;
}

of course though, we’re committing the heinous by having multiple return statements in the same function. no explanation or logic other than that’s the way you must code. and i have heard it impressed upon soo passionately, it was frightening.

not to say that the alternative is better, that’s another discussion. it’s just that tradition is so entrenched that questioning it is out of the question 🙂 and when you’re still learning, these dogmatic rules become so strong that later in programming life, it’s hard to change.

but i guess that’s no different from other avenues of life-learning…

any other hard to break traditions out there which defy logic and which have a neater alternative? and more so… when you do use the alternative, how many eyebrows are you raising?