How To Write Unmaintainable Code
freeworld.thc.org
freeworld.thc.org
Compliance with this direction is... sporadic.
/ implement first business logic */ public void process() { ... }
then you do pop quiz-style code reviews. let someone's code get reviewed by his peers.
"Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live"
This may be the single most important piece of advice in the history of writing source code.
Then why do I keep running into violations of this. Just yesterday. Again today. 3 times last week. It's tough enough sifting through your garbage when I don't know what the variables means, it's 10 times tougher when I can't find them.
The solution? If you ever murder a programmer who wrote
for x = xx to xxx
the penalty should be an $18 fine and community service.[Seriously, I would amend this rule to, "No variable name should fully contain any other variable name or reserved word." If I do a global search for "vendEmail" I should get every instance of that variable and nothing else. Naming variables is not rocket science. Sometimes it just seems that way.]
My guideline is to use descriptive English words, not abbreviated. I take a minute to find the right word, check the dictionary or Google when necessary. If the same identifiers are used across the codebase, then they're used to describe similar feature. A little extra typing saves lots of debugging time. Not that my code has any bugs, mind you :)
The other guideline is to spend more time choosing names for interfaces than for implementation variables, but that's just part of the general "interfaces are more important to get right."
>> for x = xx to xxx
>>the penalty should be an $18 fine and community service.
I would respectfully submit that the community service has already been done (by definition), and that $18 is sufficient to cover the cost of the paperwork.
unused local variable warnings? i = i; PRICELESS
#define TRUE 0
#define FALSE 1