Friday, December 7, 2007

Flow chart is a powerful tool/technique

Have u ever stuck in programming? Most of the time I always do , when debugging own program , or worst case is to debug other's . Yeah.. syntax errors are easy to be identified, let the assembler/compiler/interpreter handle it! But the problem lies in what is called algorithm error or the logical error.
Sitting in front of the computer wasting time looking at the lengthy program while trying to figure out the flow of the program, refer to the flowchart! No flowchart? study the program to get a brief insight then create flowchart and start it over again. There is no point to troubleshoot a program that come without a logical graphical presentation.
Some genius people may think that flowchart is not important. "There is no need for flowchart! Everything is in my head", they may say. Its up to them , but consider this few following reason:

  1. Flowchart can be translated into any programming language
  2. Flowchart can be easily understood by other non-programming people
  3. A logically wrong flowchart cannot produce a well-working program
  4. There are few people who can all programming language
  5. Trouble shoot a program takes long time, trouble shoot a flowchart takes shorter time
  6. We can review the flowchart anywhere, but to debug a program we need a computer
Flowcharts can be a very powerful technique, followings are some tips:
  1. Start with a simple main flowchart to get an overall picture. Maybe without any if else structure or do while structure , just a plain sequence by sequence. Use suitable wordings for each block.
  2. Start zoom in every block/process and roughly estimate the complexity of the flowchart (or sub flowchart) for each block/process.
  3. Draw the flow chart for each process, start from the simplest one.
  4. Repeat step 2 and 3 if needed.
  5. Try to combine the flowchart altogether and analyze it ( maybe this step is not needed, but sometimes it helps)
For programming part
  1. Test all modules and main flow first, trace the flow by printing out some values in text files or in console if the debugging tools are not available.
  2. If all the modules work as expected combine it to follow the main flow. Else, recheck again the flowchart.
  3. Another tips is try replace each block/process with a two/three line of program before typing.

Te given technique are very powerful when dealing with low level language , however i believe that it can also be used for high level language.

No comments: