Previous | Home | Next |
All the programs consist of two elements : process (logic) and data. There can be two different approsaches depending upon wheather our main focus in on processing or data. The procedural programming languages (C, FORTRAN, PASCAL, COBOL etc.) focus on the processing part i.e they give more importance to "What is happining "(process) in the system and less importance to "Who is being affected" (data).
The procedural apporach becomes less and less suitable as the programs become large and complex. The object oriented programming languages were developed to overcome the limitation of the procedural programming. The object-oriented programming language are relatively far less complex as compared to the programs within the procedural languages.
The object oriented programs are organized around the data(i.e objects) and a set of well defined interface(public methods ) to that data. Java is based on object oriented paradigm. Java is almost pure object oriented programming language. We have termed "almost" as java also supports primitive data types due to performance reasons. The c++ is not a pure object oriented language. C++ is an extension to c so it uses an approach, which is a mix of procedural-oriented approach and object-oriented approach.
- Object-oriented programming
- Procedural Programming
- The object-oriented programs are data centric while the program written in the procedural languages are process centric.
- The object oriented programs are organized around data (Objects) so they model the real world objects in a better way.
- The degree of reusability and extensibility of the code is very high in case of object-oriented approach as compared to procedural approach. So code size is less.
- The object-oriented programs are easier to maintain, as they are relatively less complex and smaller in size.
- The object-oriented progrrams are based on the bottom-up design methodology while the procedural programs are based on the top-down design methodology.
Object-oriented programming can be seen as an extension of procedural programming in which programs are made up of collection of individual units called objects that have a distinct purpose and function with limited or no dependencies on implementation. For example, a car is like an object; it gets you from point A to point B with no need to know what type of engine the car uses or how the engine works. Object-oriented languages usually provide a means of documenting what an object can and cannot do, like instructions for driving a car.
Procedural programming can be defined as a subtype of imperative programming as a programming paradigm based upon the concept of procedure calls, in which statements are structured into procedures (also known as subroutines or functions). Procedure calls are modular and are bound by scope. A procedural program is composed of one or more modules. Each module is composed of one or more subprograms. Modules may consist of procedures, functions, subroutines or methods, depending on the programming language. Procedural programs may possibly have multiple levels or scopes, with subprograms defined inside other subprograms. Each scope can contain names which cannot be seen in outer scopes.
Description | Procedure Oriented Programming | Object Oriented Programming |
Divided Into | program is divided into small parts called functions. | program is divided into parts called objects. |
Importance | Importance is not given to data but to functions as well as sequence of actions to be done. | Importance is given to the data rather than procedures or functions because it works as a real world. |
Approach | follows Top Down approach. | follows Bottom Up approach. |
Access Specifiers | does not have any access specifier. | access specifiers named Public, Private, Protected, etc |
Data Moving | Data can move freely from function to function in the system. | objects can move and communicate with each other through member functions. |
Expansion | To add new data and function in Prcedural Oriented Programming is not so easy. | Object Oriented Programming provides an easy way to add new data and function. |
Data Access | Most function uses Global data for sharing that can be accessed freely from function to function in the system. | data can not move easily from function to function,it can be kept public or private so we can control the access of data. |
Data Hiding | Procedure Oriented Programming does not have any proper way for hiding data so it is less secure. | Object Oriented Programming provides Data Hiding so provides more security. |
Overloading | Overloading is not possible. | overloading is possible in the form of Function Overloading and Operator Overloading. |
Examples | Example of Procedure Oriented Programming are : C, VB, FORTRAN, Pascal. | Example of Object Oriented Programming are : C++, JAVA, VB.NET, C#.NET. |
Previous | Home | Next |