Wednesday, April 28, 2010

My basic rules of programming

Here I am listing some general rules of programming that I learned to follow.
Some of them are enforced by certain languages or programming environments but some are very permissive and require to be more careful. These rules are already well known but here they are again
  • Define very well the input from the output arguments of a function. The input arguments should remain unmodified in the routine.
  • Never write a routine that cannot fit in one page of computer screen in the worst case.
  • Develop and validate a program in reasonable small steps. It may take longer to write the code but it will take less time to debug.
  • Use a maximum of two nested loops in a certain routine.
  • Use meaningful names for the variables even if they become long.
  • Do not repeat the same task in different places.

No comments:

Post a Comment