Pure Theory: MUST BE Rooted Programming Habit:


Sunday, February 27, 2011

MUST BE Rooted Programming Habit:

Having programming for several years, I think it's important to know how much power there is in what I already know. Any interesting program could be written by the programming language I learned from a programming course. The features of the current programming language are very powerful, and it's not all for building an interesting program or complex algorithm. Just write it in a cleaner and better way. In another word, one becomes a good writer not by learning additional vocabulary words but by ļ¬nding something to say. Thus, after you know all the words for that programming course, the only problem left is how to write it with quality and your personal characters.

Generally, the following rules should be followed:
  1. Write the Comments First; Start your program with few words could help you be more clear about the problem, your algorithms and how to implement it.
  2. Document each variable; Put one-line words for each variable could clearly know what it does in that program at any time you need it.
  3. Use subroutines to avoid Redundant Code; Try your best to make each function independent with each other, which will be helpful for large program debugging.
  4. Make Debugging log; It would be useful to keep track of debugging. That saves your time for not debugging with same thing, also it could exclude the checked situations;
  5. Use Enumeration; Sometimes, it would be more clear for the programmer to enumerate every possible case rather than spend so much time on playing with logic.
Root these in mind, keep these with your fingers. Then, you will never unable to read the code you wrote before.

No comments: