Skip to content

Latest commit

 

History

History
16 lines (15 loc) · 1.05 KB

code-best-practices.md

File metadata and controls

16 lines (15 loc) · 1.05 KB

Uncle Bob's rules:

  1. All functions should be 8 or fewer lines.
  • No function should have more than two levels of indent.
  • Names should be communicative and explicit.
    • Variables in short scopes should have short names
    • Variables in long scopes should have long names
    • Functions in long scopes should have short names
    • Functions in short scopes should have long names
  • The code should read like well written prose and have very few comments.
  • As you read the code you should not have to look up the definitions of the variables and functions being called. They should be obvious.
  • Function calls should have 3 or fewer arguments, with a preference for fewer.
  • Unit test coverage should be close to 100%, and the programmer should know the coverage number.
  • Unit tests should be short, easy to read, and easy to understand. You should be able to understand the program by reading the tests.
  • The tests should execute very quickly. Long running tests are a symptom of carelessness.

original link