DEV Community

Shalim Mora
Shalim Mora

Posted on

What is Object-oriented Programming ?

Object Oriented Programming is a different way of programming and with this type of programming we can express ourselves more precisely to things in real life than other types of programming.
Well, first of all we must learn to identify What is an object ?, since an object is one that has Attributes (Characteristics), Methods (Actions).
Most of the post is as an example of an object to a car and that meets the requirements of having Attributes and Methods.

Image description

But we can also use a fraction like 8/8 as an example since it also complies with having Attributes (Numerator and Denominator) and Methods (It can be simplified, it can be added with another fraction, it can be subtracted with another fraction).
Now let's see what are classes?
Well, a Class is a set of objects that have
similar attributes and methods.
In the case of Java, the first thing we create is a Class and from this class we create the objects with their methods and attributes, it is important to know that once we have a class we can create all the objects we want within it.
What is a message in Object Oriented Programming?
It is the one that allows objects to interact, once an object has received a message it will change its state or the execution of some task.
Techniques of the six-year term:
Within the object-oriented programming the "Techniques of the six-year term" are used, which are: Inheritance, Cohesion, Coupling, Abstraction, Polymorphism and Encapsulation.
And so that you do not remain in doubt, I will give you a simple explanation of each one.
INHERITANCE:
It is the mechanism in which a class inherits the attributes and methods of another class, inheritance facilitates code reuse and is an important concept of OOP.
COHESION:
It does everything about how a single class is designed, the term cohesion makes it known that a certain class was made for a single purpose and the elements within this module stay together.
Whenever coupling is reduced, cohesion increases.
COUPLING:
This refers to the degree of direct knowledge that one element has of another, a measure of how closely connected two routines or modules are.
ABSTRACTION:
The abstraction is the one that shows only the necessary attributes and hides the information that is not necessary.
POLYMORPHISM:
Occurs when there are one or more classes or objects related to each other by inheritance.
Simply put, it is the ability of an object or class to take many forms.
And last but not least:
ENCAPSULATION:
It makes the grouping of data these references, including the methods that operate, but in a single unit
Even some programming languages ​​use encapsulation in the form of classes.
This was only a small explanation about each of these techniques but later I will make a more detailed explanation about each one including examples and images. 😉
Now we go to the programming languages ​​that deal with object-oriented programming.
In itself the term Object Oriented Programming was created by Alan Kay and this was inspired by the Sketchpad program, but the first language that was recognized as object oriented was Simula, later Alan Kay along with other programmers created Smalltalk.
Currently the best known languages ​​that use Object Oriented Programming are:
Phyton
Javascript
Ruby
Scala
PHP
Java
C ++
Among others…

Oldest comments (0)