When you feel the need to write a comment, first try to refactor the code so that any comment becomes superfluous.
Refactoring: Improving the Design of Existing Code by Martin Fowler, Kent Beck (Contributor), John Brant (Contributor), William Opdyke, don Roberts
ISBN: 0201485672 This book is available from
Don't comment bad code ‐ rewrite it.
Eagleson's Law: Any code of your own that you haven't looked at for six or more months might as well have been written by someone else.
When you come across a stumbling block because the code doesn't quite fit anymore, or you notice two things that should really be merged, or anything else at all strikes you as being “wrong”, don't hesitate to change it. There's no time like the present.
It's not at all important to get it right the first time. It's vitally important to get it right the last time.
Don't live with broken windows.
DRY ‐ Don't Repeat Yourself ‐ Every piece of knowledge must have a single, unambiguous, athoritative representation within a system.
Terrible code is not a good excuse to be mean, because terrible code is not well-correlated with having been written by terrible people.
A Fallacy of Software: If it works, and we don't change anything, it will keep working.
Refuctoring — the process of taking a well-designed piece of code and, through a series of small, reversible changes, making it completely unmaintainable by anyone except yourself.