Return to site

Reasonable coder, you should be! 👽⭐🗡️

· programmmer

Reasoning semiformally about correctness is the way to go: use hand checking when automated tools can't.

Check by dividing your code into sections from a single line to a bunch of ten lines.

Choose your section by concept: preconditions, postconditions (for functions), and invariants (for loops and classes).

The sections should be as independent as possible, to facilitate reasoning and modification.

Most of these practices should be adopted:

  1. Avoid using goto statements
  2. Avoid using mutable static variables
  3. Make the variable scope the smallest possible.
  4. Make when possible your variables immutable
  5. Indent your code
  6. Use self-documenting, self-descriptive names
  7. Extract functional code unit into function
  8. Make your functions short and one goal-focused (24 lines limit)
  9. Limit if possible to 4 parameters (group them in an object if necessary --request)
  10. Your interfaces should be narrow hashtag#encapsulation
  11. Use setters when necessary

#programmer #reasonable #coder #goodPractices #developer #programming