What is good style?1
Good style in any language consists of code that is:
- Easy to develop and debug
It also helps ensure correctness, robustness, and compatibility. Maxims of good style are:
- Be explicit
- Be specific
- Be concise
- Be consisten
- Be helpful (anticipate the reader's needs)
- Be conventional (don't be obscure)
- Build abstractions at a usable level
- Allow tools to interact (referential transparency)
Know the context when reading code:
- Who wrote it and when?
- What were the business needs?
- What other factors contributed to the design decisions?