Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 1.47 KB

File metadata and controls

32 lines (24 loc) · 1.47 KB

Code requirements

Guidelines

  • High priority: write code which avoids the need for global reasoning
  • High priority: robust error handling rather than relying on "being careful."
  • Create property-based tests in preference to simple unit tests when the problem domain allows.
  • Document and exploit invariant properties of types and functions.
  • Enforce invariants at compile time when the language or framework supports it.
  • Require runtime validation and for invariants which cannot be compile-time enforced
  • Performance is important, but it is less important than correctness; it does not matter how quickly you can do the wrong thing. See benchmarking for performance measurements.
  • If you are writing code that corresponds to an RFC, use Duvet to document compliance

If you need to write a test, prefer property-based tests over simple unit tests. If you need to handle errors, prefer Result types over panics in general, but see the error handling guide for details. If the code or the test is meeting a requirement from an RFC, cite it: see specification compliance.

Error handling

If you need to handle an error, follow the guidelines.

Testing instructions

See testing instructions