A program can be written to revolve around its code or its data. A Process-oriented model is written in such a way that code acts on data, whereas an Object-oriented model is written to act around its data. The primary goal of this Blog is to provide an overview of the Implementing OOP concepts in Selenium as they are applied in a Selenium automation framework. Join Selenium Training in Chennai to gain knowledge about concepts in Selenium.
Refresher On OOPs Concepts (Java)
Encapsulation is a method that connects code with the data it manipulates. This single unit is a class, interface, or similar term in object-oriented programming.
In Java, encapsulation can be done by doing the following:
- By designating a class’s variables as private
- Changing and reading variable values with getter and setter methods
It is the technique of concealing implementation details so the user does not have to know what is happening behind the scenes when consuming functions. Join Selenium Online Classes at FITA Academy to get indepth learning about Abstraction.
One of the most significant ideas in OOPs is inheritance. If we wish to comprehend it from a real-world perspective, consider the vehicle, which includes a car, a bus, and a bike. It is an example of an IS-A relationship, also referred to as a parent-child relationship.
The primary reason we use inheritance is as follows:
- Method overriding, as we will see in the Polymorphism explanation
- Reusability of code
The Following Inheritance Types are Listed
- Single Inheritance: occurs when a single class inherits another class.
- Multilevel Inheritance: Multilevel inheritance occurs whenever there is a chain of inheritance.
- Hierarchical Inheritance: Hierarchical inheritance occurs when numerous classes inherit a single class.
- Many Inheritance: Multiple inheritance occurs when a single class inherits from many classes. Please keep in mind that Java does not support multiple inheritance.
- Hybrid Inheritance: Hybrid inheritance is a mix of different types of inheritance. You can join the Selenium Course in Bangalore for in-depth learning about Hybrid inheritance and land your dream job as an internet developer at a multinational corporation.
The concept of polymorphism is crucial in object-oriented programming. It merely indicates that there are multiple forms. Java supports the following types of polymorphism:
- Polymorphism at compile time (static polymorphism)
- Polymorphism at runtime (dynamic polymorphism)
Also, Check: Selenium Tester Salary for Freshers.