Procedural Oriented Approach | C++ Programming

Procedural Oriented Approach | C++ Programming

In procedural oriented approach programs are organized in form of subroutines. The subroutines do not let the code duplication. P.O. is suitable for medium sized software C, Pascal, FORTRAN etc. Are procedural oriented language.
            A program in a PL is a list is a list of instruction that tells the computer to do something. Such as get some input add these number, divide by 5 display output.
            The primary focus of POL is on function rather than data.
             The idea of breaking program into function can be entered by grouping a no of functions together into a larger entity called module.

Procedural Oriented Approach
Fig: Typical program structure in procedural programming

Problem with SP

                As program grow ever larger and more complex even the structured programming approach begins to show signs of strain. No matter how well the SP is implemented large programs become excessively complex causing to sleep the schedule extra programmer need to be added increasing project cost.
                The two reasons for these problem with P.A are: -
1.       First functions have unrestricted access to global data
2.       Second, unrelated functions and data the basis of procedural paradigm, provide a poor model of the real world.

Unrestricted Access: -

                A program in P.A use two kinds of data.
  • 1.       Local Data
  • 2.       Global Data

When two or more functions have to access the same data the data must be declared global. Global data can be access by any functions in the program.
         The arrangement of global data and local data of the program in P.A.
Procedural Oriented Approach

When there are many function and many global data item in a program there be difficulties to established a connection between the functions. & data finally lead large number of problems such as:
  • 1.       It makes a program structure difficult to conceptualized.
  • 2.       It makes program difficult to modify.
  • 3.       As single change in a global data item main associated rewriting all the functions that access that global items.

Real World Modeling: -

                The second and more important problem with P.P is that its arrangement of separate data and functions does a poor job of modelling things in the real world.
                In real world we deal with objects such as people, car etc. and such objects aren’t like the data and they aren’t like function. These object have both attributes and behavior.
                To model such objects, we need both data and fi=unction that operate a data on a single unit that is not separate individuals.
Procedural Oriented Approach

Characteristics of P.A: -

  • 1.       Emphasis is on doing thing(algorithm)
  • 2.       Large program is divided into smaller programs (function)
  • 3.       Most of the function share global data.
  • 4.       Data move freely or openly around system from function to function.
  • 5.       Function transform the data from one form to another.
  • 6.       Top down approach of program

Limitation of P.A

  • 1.       To revise external data structure all, the function that access data should be revised.
  • 2.       Focuses on function rather than data.
  • 3.    It doesn’t model real world problem very well since function are action oriented and don’t          really correspond to element of problems.

Post a Comment