What is Object Oriented Paradigm in Java?
The term Programming paradigm means the methodology for writing program codes. In general, two paradigms govern how you can construct a program. These two ways are:
- a process-oriented model
- an object-oriented model
Many programming languages support both the paradigms like python. Python allows the users to code using both process-oriented and object-oriented methodologies. However, Java is exclusively object-oriented.
What is Object Oriented Paradigm
The object-oriented programming paradigm (OOP) has a completely different approach to problem-solving. It does not focus on the problem that needs to be solved but focuses on the objects that make up the system. You can compare objects with real-life entities like a car or a dog, and all these objects have a state and behaviour.
For example, a car state includes its name, colour, brand, and its behaviour includes moving, slowing down, and changing gears.
Therefore, the goal of an object oriented paradigm is to represent the real world while writing code.
Features of the Object Oriented Paradigm
- OOP breaks a problem into a number of entities called objects and then builds data and functions around them.
- It treats data as a critical element in the program development and therefore restricts the flow of data.
- OOP protects the data from accidental modification from outside functions.
- Objects of the different classes can interact easily through functions.
- The object-oriented paradigm follows a bottom-up approach.
Comparison between Procedure-Oriented and Object-Oriented Approach
- In the case of POP, the program is divided into small parts based on the functions. On the other hand, in OOP, the program is divided into objects, which are instances of classes.
- In procedure-oriented programming, functions are the highest priority, and data is the lowest priority. Whereas in object-oriented programming, the data is a critical element.
- The procedure-oriented approach is less secure in comparison to the object-oriented approach. In OOP, due to abstraction data hiding is possible, which makes it more secure.