Computer Applications
What are the differences between Procedural Programming and Object-oriented Programming?
Answer
Procedural Programming | Object-Oriented Programming |
---|---|
Follows a top-down approach | Follows a bottom-up approach |
Instruction Oriented | Data Oriented |
The abstraction is at procedure (function) level. | The abstraction is at object (class) level. |
The sequence of events in a large program is divided into functions. | Entire program is divided into objects. |
Interaction with program is via direct function calls. | Interaction with program is via functions defined in the class only. |
Real world is represented by 'procedures' operating on data. | Real world is represented by objects and the operations that can be performed on these objects. |
Data and functions are separate. | Data and functions are encapsulated into a single unit. |
Data security is less as it contains lesser features to protect the data. | It is more secure as one of its primary features include data hiding. |
A function can access any other function's data by calling that function. | Only the data whose access has been granted can be accessed by another function. |
Limited and difficult code reusability. | Versatile and easy code reusability. |
Code is difficult to modify, extend and maintain. | Code is easy to modify, extend and maintain. |
Some examples of Procedural Programming languages are C, COBOL, Pascal. | Some examples of Object Oriented languages are C++, Java, C#. |
Related Questions
Explain the difference between Inheritance and Encapsulation with suitable examples.
What are objects? Give five examples.
Explain the following statement — "Class is a specification for objects".
Polymorphism means different forms. Explain Polymorphism in Java and provide examples to support your answer.