转自这
- try to write as less code as possible.
- refactor your code often; trying to avoid duplicate stuff, improving its readability and simplifying its structure without changing its results.
- comment your code as much as possible (comments do not count as code :) )
- avoid complex code structure with large class hierarchies that are used only once and in a single path.
- do not optimize early
- do not generalize early
- try to avoid very long functions