As in, don’t repeat yourself.
Tag Archives: clean code
Make code re-use easier.
Code that is easier to understand is more likely to be reused.
When in doubt, use parentheses.
Don’t confuse the “and”/ “or” operators with the “&&”/“||” operators.
Add comments to explain ideas.
Some things are not obvious from self-documenting code.
Newlines are free.
Avoid creating really long lines of code.
Kent Beck’s Rules of Simple Design, #2
The code must express the intent of the programmers.
Write code to be read.
Software code and tests are read much more than they are written.
Don’t get clever.
Don’t write complex software just because the technique looks cool. From time to time new techniques will appear on the web, and then everyone will start over-using them for anything and everything. A couple years ago it was the repository pattern. This pattern has its uses, but when working with a framework that already hasContinue reading “Don’t get clever.”
Look out for comments at the end of a block.
They may seem helpful, but they’re also a bad sign.
Code shouldn’t need an explanation.
Sometimes comments are a red flag.