Chapter 4: THE WRITE STUFF
- Don’t write code that needs to be propped up by external documentation. It’s flimsy. Ensure that your code reads clearly on its own.
- Write your code to be read. By humans. Easily. The compiler will be able to cope.
- Write Simple Code with Good Presentation
- Choose Meaningful Names
- Decompose into Atomic Functions
- Avoid magic numbers. Use well-named constants instead.
- Don’t return nonsensical errors. Present the appropriate information in each context.
- Only add comments if you can’t improve the clarity of the code in any other way.
- Don’t document bad code—rewrite it.
Jun 17, 2010
comments powered by Disqus