Thursday, August 25, 2011

Object Oriented Programming (OOP) and Procedural Programming Approach


Object Oriented Programming (OOP)

Since Java is an Object Programming Language, I have decided to write on the concept of Object Oriented Programming before moving to details about Java. So in this post and a few subsequent posts, I shall be writing about the concept of Object Oriented Programming.

Before Object Oriented Programming came into effect, procedural programming was in use. Programs written using procedural programming approach consist of various functions. These functions can be executed anywhere within the program. The functions of procedural programs are interdependent; therefore they are difficult to separate from one another. These interdependent functions can not be reused in other programs. As a result, even for a similar task across programs, the entire function has to be recoded. This made program development a complex task.


Data in procedural programming is visible and accessible throughout the program, making it easy to manipulate the data from anywhere in the program. Some examples of procedural languages are COBOL (Common Business Oriented Language), Pascal and BASIC (Beginner’s All Purpose Symbolic Instruction Code).  All procedural languages lack support for OOP. The limitations of procedural programming let to the evolution of Object Oriented Approach. In OOP the program is broken into independent chunks known as object, which can be integrated to create a complete program. In OOP, Objects can be reused across various programs. This enables a programmer to develop application in a relatively short duration. A major advantage of OOP is the reusability of code and as such, it saves the effort required to rewrite the same code for every program using the functions defined in libraries.  Reusability of code not only saves time but also the effort of the programming team. 

No comments: