Quote:
Originally Posted by goofyballer
I've come around to the belief that habits matter, and that employing a ****ty habit in a situation where the context that makes it okay is still bad because a.) someone has to look at and understand the context to know that it isn't bad, instead of just not having to evaluate the context at all because the code was written properly to begin with b.) it increases the possibility that habit will slip into other areas of your coding.
Disclaimer: in this particular context, I don't know Javascript or whatever language that is.
sure, i don't disagree.
an analogy might clarify my position here. somebody turns in an essay that wasn't spellchecked, and has some sloppy capitalization errors too. that's clearly bad, you shouldn't do it, there's not really an excuse for it.
if you're the teacher, one type of reaction to that paper is, "this person is clearly an idiot, i'm going to skim the paper but basically i've already decided it's going to be a bad grade because how could it not be." imo, such a teacher is making a worse mistake than the student who didn't bother to spellcheck his essay.
even though the teacher is correct that there's a
correlation between sloppiness and bad writing in a deeper sense, it's not as strong as you'd think. but more importantly, they are
fundamentally different kinds of errors, both in importance and in kind.
and you can't ever forget that and just dismiss stuff that's sloppy
as if it were fundamentally bad, because your own judgment will suffer. and there is another error, fairly common, in which you can focus lots of energy on things like style guides and consistency and convince yourself that you are a good, careful coder with immaculately high standards, standing above the hoards of sloppy php slingers, while
completely missing the big picture, oblivious to bad architectural flaws and other problems that really matter.