Examples
var whetherToReturnTheResult = true;
return whetherToReturnTheResult;
This coding pattern is naming everything to a variable, regardless of whether you need to save it. This is usually rooted in a few magical beliefs:
"I need to declare this variable"
This can be from people who have tinkered in other languages and used to pay a lot of attention to their int
and
float
declarations etc etc: they expect that any value requires maintenance.
Examples
for (var i = 0; i < 10; i++) {
try {
// all of the application code here
} catch(e) {
console.log('I have no idea what went wrong');
}
}
This is rooted in a few magical beliefs:
- A caught error is better than an uncaught one
- Failing silently is better than failing loudly
- I don't know what kinds of errors my code will produce
Examples
function MyProgram() {
this.someTemporaryVariable = 5;
if (this.someTemporaryVariable) {
// ugh
}
}
This is rooted in an "Object-Oriented Education", usually in Java or something like that: it avoids the use of scope for any value and instead assigns every value, even temporary results, to an object.