I’ve spent a lot of my time lately working on projects that were in trouble. The projects were behind schedule, buggy, and hard to work on. My team was asked to look the projects over and help fix the problems.
In every one of these cases, the code looked awful: spelling mistakes everywhere, dead code galore, and no coherent style whatsoever. I’m coming to the realization that ugly code is a trait of bad software. Good engineers naturally write readable code. They care about their code and it shows.
In one project I was working on recently the word cartridge was misspelled as catridge. It made code navigation tools useless. I could never find the class CartridgeModel because it was in fact CatridgeModel. It took days and days of “Doh!” until I finally fixed the problem.
Do your team a favor and fix spelling mistakes. Most modern editors support spell checking so you can usually avoid the problem altogether.
I’ve done it myself: comment out a few lines of code and then check it in. Dead code happens. But whole pages of code commented out and left that way forever? Whole files that have no content because it is all commented out? That’s nuts.
You’re using source control (you are using source control right?) so you can always get that content back by looking at the file history. Just delete it. All that cruft is doing now is taking up valuable space and making the code more difficult to understand.
Write one, adhere to it, enforce it.
Like most rules there are always exceptions. I don’t think that the rules listed here are applicable in every situation. Readability may suffer for performance or a word may be intentionally misspelled for marketing reasons, but most of the time these things matter. At least to me. :)