Summary and recommendations

Some simple hints and tips in order to write clean and clear code
  1. Spell out the algorithm and have a top-down approach to the flow of data
  2. Start with coding as close as possible to eventual mathematical expressions
  3. Use meaningful names for variables
  4. Split tasks in simple functions and modules/classes
  5. Functions should return as few as possible variables
  6. Use unit tests and make sure your codes are producing the correct results
  7. Where possible use symbolic coding to autogenerate code and check results
  8. Make a proper timing of your algorithms
  9. Use version control and make your science reproducible
  10. Use IDEs or smart editors with debugging and analysis tools.
  11. Automatize your computations interfacing high-level and compiled languages like C++ and Fortran.
  12. .....