OOP or Oriented Object Programming , is a very common
notion in IT field .
It's a programming concept
that concerns of building class and creating objects in order to solve problems
.
The opposite concept is Functional Programming.
Imagine you are in a factory and
want to create cars , so you define the model so that the objects
can be created with the same shape and characteristics.
We have remarked that some
data structured are being repeated ,
some functions have common
huge number of variables ,
So as you guessed the OOP is the savior😍and here's why :
1/Encapsulation :
it means that data are
structured within a defined Class ,each class have a specific attributes and
methods . for example :
here the Class Car posses his
own attributes that can be only accessed by it.
2/abstraction :
For a better user experience we don't care about hidden functionalities
😉
3/Inheritance :
It's a very interesting
concept in OOP , it allows us to create class for already existing one , since
both of them share a common structure or some of it at least!
The one that pass the
structure is called parent the child is the one who get it .
In some programming language
it's allowed to have multiple inheritance (one child can inherit from multiple
parent ).
This will help to avoid
repeating unnecessary code .for example:
The Rabbit class inherit
from animal .
4/Polymorphism :
After using inheritance we aim
to make some changes with the child .We can re-define methods with the same
name and different functionality . in order to fit the new class .
This was a brief explanation
of OOP ,it's not a monster just try it 😁😁.
Subscribe to:
Post Comments
(
Atom
)
No comments