Styleguide for programming

Anna Ikoki
2 min readNov 30, 2022

This is how you can make your program readable:

READABILITY

  1. Write your code clearly — don’t be too clever nor too efficient over clarity.
  2. Say what you mean, simply and directly for easy understanding.
  3. Write first in easy-to-understand pseudo language; then translate into whatever language you have to use.
  4. Modularize. Use procedures and functions to avoid repetitive expressions
  5. Use in-built functions first.
  6. Use parenthesis and indentation to avoid ambiguity.
  7. Format a program to help the reader understand it.
  8. Don’t patch bad code — rewrite it.

VARIABLES

  1. Use variable names that are relatable and meaningful.
  2. Avoid too many temporary variables.
  3. Initialise all variables before use.
  4. Choose a data representation that makes the program simple.

INPUT

  1. Make sure input doesn’t violate the limits of the program.
  2. Identify bad input; recover if possible.
  3. Make input easy to prepare and output self-explanatory.
  4. Use uniform input formats.

--

--