In a procedural programming the problem is viewed as the sequence of things to be done such as reading, calculating and printing. A number of functions are written to accomplish these tasks. The primary focus is on the functions. A typical program structure for procedural programming with the technique of hierarchical decomposition for solving problem is as shown:
Main dependence of procedural programming is on writing a list of instructions for the computer to follow and organizing these instructions in to groups known as functions. We normally use flowchart to organize these actions and represent the flow of control from one action to another. Basic idea during function development is that no more attention is given to the data which the function operates on. Then, what is the effect of function on data?
In the multi-function program provided global data shared by all the functions also have their own local data.
Global data are more vulnerable to an inadvertent change by a function. In a large program, it is very difficult to identify the functions using the particular data. In such cases, we need to revise an external data structure as well as all the functions that access the data. This provides an opportunity for bugs to creep in.
Another drawback of procedural approach is that it don’t model the real world problems very well which is because the functions are action oriented and do not really correspond to the elements of the problem.
- Emphasis on doing things (algorithms).
- Large programs divided into smaller programs named functions.
- Most of the functions share global data.
- Data move openly around the system from function to function.
- Employee top-down approach in program design.