Flowcharts
Tools used in preparation of an algorithm are flowcharts. A flowchart is a diagrammatic or pictorial representation of algorithm steps that illustrates the sequence of operations to be performed to arrive at a solution.
In the flowcharts the instructions are depicted using special symbols. These symbols are connected through arrows to indicate the order of execution.
Symbols:
Fig: Symbols of Flowcharts
While programmers have a good deal of freedom in creating flowcharts, there are a number of general rules and guidelines. Some of the rules and guidelines are as follows:
- First chart the main line of logic, and then incorporate detail.
- Maintain a consistent level of detail for a given flowchart.
- Do not chart every detail or the flowchart will only be a graphic representation, step by step, of the program. A reader who is interested in greater details can refer to the program itself.
- Words in the flowchart symbols should be common statements and easy to understand. It is recommended to use descriptive titles written in designers own language rather than in machine oriented language.
- Be consistent in using names and variables in the flowcharts.
- Go from left to right and top to bottom in constructing flowcharts.
- Keep the flowchart as simple as possible. The crossing of flow lines should be avoided as far as practicable.
- If a new flowcharting page is needed, it is recommended that the flowchart be broken at an input or output point. Moreover properly labelled connectors should be used to link the portions of the flowchart on different pages.
Advantages of Flowcharts
The following benefits may be obtained when flowcharts are used for the purpose of program planning.
- Better Communication: We can say that a flowchart is a pictorial representation of a program; it is easier for a programmer to explain the logic of a program to some other programmer or to his boss through a flowchart rather than the program itself.
- Effective Analysis: A macro flowchart that charts the main line of logic of a software system becomes a system model that can be broken down into details parts for study and further analysis of the system.
- Effective Synthesis: A group of programmers are normally associated with the design of big software systems. Each programmer is responsible for designing only a part of the entire system. So initially, if each programmer draws flowcharts for his part of design, the flowcharts of all the programmers can place together to visualize the overall system design. Any problem in linking the various parts of the system can be easily detected at this stage and the design can be accordingly modified.
- Proper Program Documentation: Program documentation involves collecting, organizing, storing, and otherwise maintaining a complete historical record of programs and the other documents associated with a system.
- Efficient Coding: Once a flowchart is ready, programmers find it very easy to write the concerned program because the flowcharts act as a roadmap for them. It guides them to go from the starting point of the program to the final point ensuring that no steps are omitted. The ultimate result is an error free program development at a faster rate.
- System Debugging: Even after taking full care in program design, some errors may remain in the program because the designer might have never thought about a particular case. These errors are detected only when we start executing the program on a computer. Such type of program errors is called bugs and the process of removing these errors is known as debugging. Once a bug is detected, it is easier to find out the reason for that bug by going through the logic of the program in flowchart form. A flowchart is very helpful in detecting, locating and removing mistakes (bugs) in a program in a systematic manner.
- Systematic Testing: Testing is the process of confirming whether a program will successfully do all the jobs for which it has been designed under the specified constraints.