Object-Oriented Programming
Object-oriented programming is programming that uses "object" to design applications and computer programs. It is a collection of cooperative objects, and each object is capable of receiving messages, processing data, and sending messages to other objects.
The fundamental idea behind OOP is to combine data and functions into a single unit i.e. object which communicate with each other by calling one another's member functions. The Function of an Object is called the member function and the data are only accessible through the member function. If we want to read a data item in an object, we call a member function in the object. We cannot access the data directly. The data is hidden, so it is safe from accidental alteration. Data and its functions are said to be encapsulated into a single entity. data encapsulation and data hidden is the key term of OOP.
Object-Oriented Programming utilizes several techniques/models including modularity, polymorphism, inheritance, and encapsulation. Due to the use of these features, it is commonly used in mainstream, software development programming languages such as C++, Java, JavaScript, PHP, C#, VB.Net, and Objective - C.
The Differences between Object-Oriented Programming (OOP) and Procedure Oriented Programming (POP) are as follows:
- In OOP, emphasis is given to data than procedure whereas, in POP, emphasis is given to procedure.
- OOP uses a bottom-up development process whereas POP uses a top-down development process.
- Class and Object is the mainstream of OOP whereas function (library or user-defined) is the mainstream of POP.
- OOP includes features such as data abstraction, encapsulation, modularity, polymorphism, and inheritances whereas POP doesn't include these features.
- In OOP, program development will be easier due to features like inheritances, polymorphism, and data encapsulation whereas in POP, program development will be completely top difficult.
- In OOP, it is easy to add new data and functions whereas, in POP, it is extremely difficult and time-consuming to add new data and features.
- In OOP, higher security can be maintained by hiding data whereas there is not any mechanism to hide data.
- In OOP, it is easy to reuse program codes whereas, in POP, there is no proper mechanism to reuse program codes.
- OOP is a comparatively newer concept program paradigm whereas POP is a primitive program development paradigm.
- In OOP, global variables can be restricted to be used by all functions and examples of OOP languages are C++, Java, PHP, VB.Net, and C# whereas, in POP, global variables are accessible to all functions so the chances of data corruption exist. Examples of POP are C, FORTRAN, COBOL.