Saltar al contenido

cuatro pilares de java con ejemplos

este problema se puede resolver de variadas maneras, por lo tanto te damos la que en nuestra opinión es la resolución más completa.

Ejemplo: oops conceptos

OOP focuses on the objects that are
required tobe manipulated instead of logic.-It makes development and maintenance easier
-Itprovidesdata hiding
-Itprovidesabilitytosimulate real-world
- less memory and organized
- reusable

OOP language follow 4 principles:1-ENCAPSULATION:We can hide direct access
todata by using private key and we can access
private data by using getter and
setter method. in my framework I have POJO
class which I use it when we need torepresent
some data as Javaobject. Sotothat we need tocreate a Javaclasstorepresent it's data.
So in POJO classI use encapsulation and 
getter setter method toaccess them.2-ABSTRACTION:It is a process of hiding
implementation details and showing only
functionality totheuser. Abstraction lets
you focus on what the object does instead of how it does it.
In my framework I have created my
PageBaseclass as superclass of the all page classes. 
I have collected all common elements
and functions into PageBaseclass and
all other page classes extent PageBaseclass.
By doing so,I don't have tolocate very
common WebElements and it providesreusability in my framework.3-INHERITANCE:It is used todefine the
relationship between two classes. When a
child class acquires all properties and
behaviors of parent class known as inheritance.
Childclass can reuse all the codes written
in parent class. Itprovidesthe code
reusability. in my framework I have
a TestBaseclass which I store 
all my reusable code and methods.
My test execution classes and 
elements classes will extend the
TestBase in order toreuse the code.4-: POLYMORPHISM:It is an ability of object
tobehave in multiple form. The most common use
of polymorphism is Java, when a parent class reference
type of variable is used torefertoa child
classobject.
I use polymorphis almost everywhere
It is an ability of object tobehave in multiple
form. The most common use of polymorphism is Java, when a
parent class reference type of variable
is used torefertoa child classobject.
E.g.:WebDriver driver =newChromeDriver();JavaScriptExecuter js =(JavaScriptExecuter)Driver.getDriver;TakeScreenshot screen =(TakeScreenshot)Driver.getDriver;WebDriver driver =newChromeDriver();

Si tienes alguna suspicacia o disposición de aclararse nuestro crónica puedes realizar una crónica y con placer lo ojearemos.

¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)



Utiliza Nuestro Buscador

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *