Pages

Clear (Source) Code

Html-source-codeImage via WikipediaThe goal is to make a source code that easy to understand and easy to read. It's why we must write a Clear Source Code. But, if you think that your code wont be read by another person, you don't have to do it.
With an Clear Source Code, it's easier for us to debug it. And also, the flow of the program wont be so complicated. The syntax error also can be minimized.

This is few things that must be considered by a programmer that wanna write a Clear Source Code:
  1. Indentation (Use space instead of tab, be consistent).
  2. Separate every part of processing in the program with comments.
  3. Use more friendly variable name instead of unfamiliar thing. For example: use "is_number" for bolean type variable instead of "number".
  4. Give comment that explained. But don't give long explanation.
  5. Don't write to long line. Break a long line to some short line (use an escape character if needed).
Other suggestion can be read from this website.
Happy Clearing Code.
Enhanced by Zemanta

No comments:

Post a Comment