Object-Oriented Programming

O

Object-Oriented Programming (OOP) is a programming paradigm, focused on the idea of ​​encapsulation, that is, the grouping of data and code that operates on them in a single structure. Another important concept associated with object-oriented programming is polymorphism, which allows abstractions to allow for a more straightforward conceptual description of the solution.

Object-oriented programming is one of the most important steps in the development of programming languages ​​towards a stronger abstraction in program implementation. It has emerged from the need to express the problem in a simpler way so that as many programmers can understand it as possible.

Thus, the units that make up a program are closer to our way of thinking than the way the computer works. Until the object-oriented programming, the programs were implemented in procedural programming languages ​​(C, Pascal) or in languages ​​that did not even provide a way of grouping instructions into logical units (functions, procedures) such as assembly language assembler).

In other words, a problem taken from nature has to be repeatedly scrambled so as to identify distinct elements that can be implemented in a programming language. A big problem of procedural programming was the separation of data from data processing units (subroutines), which made it very difficult to extend and maintain a program. Thus, it has been the problem that these two entities (data and subroutines) are grouped in a certain way, so that the subroutines always “know” what data they process and, moreover, they form a module, that is, a unit which separates the implementation of the interface, which implies the possibility of reusing the code.

So the class concept appeared. The class realizes, in the present case, what we have seen before: grouping data and processing units into a module, thus uniting them into a more natural entity. Although the technique is called “Object Oriented Programming,” its basic concept is Class. The class, in addition to being able to be abstracted from the analysis/synthesis of the problem, has the property of generality, it designates a lot of objects that share a range of properties. Moreover, if we add new and new attributes we will individualize the class so that we come to a concrete case, which is the Object. Once the entities have been identified (in this case the classes), they are not isolated; they will be grouped into modules, packages, programs, etc., which will establish links between them. The class that inherits the attributes of another class is called “derived class” and the class that has heirs is called the “base class”. Terminology is also intuitive in this case. One of the advantages of the inheritance, which is observed directly, is the reuse of the code: the derived class will no longer implement the basic class methods, but only implement its specific methods; moreover, the derived class will contain (through the inheritance) all attributes (data and subroutines or “methods”) of the base class. Inheritance is also a fundamental relationship in the POO (Object Oriented Programming), which is recognized as a basic principle, along with Abstraction, Encapsulation, and Polymorphism.

Basic principles
1. Abstraction – It is possible for a program to separate some aspects of the information it manipulates, ie the possibility to focus on the essentials. Each object in the system has the role of an abstract “actor” who can execute actions, modify and communicate his status, and communicate with other objects in the system without revealing how those facilities have been implemented. Processes, functions or methods may also be abstract, and in this case a variety of techniques are needed to expand abstraction.
2. Encapsulation – also called hiding of information: Ensures that objects can not change the internal state of other objects directly (but only by methods provided by the object); only the object’s own methods can access its status. Each object type exposes an interface for other objects that specify how those objects can interact with it.
3. Polymorphism – It is the ability to process objects differently, depending on their type or class. Specifically, it is the ability to redefine methods for derived classes.
4. Inheritance – Organizes and facilitates polymorphism and encapsulation, allowing the definition and creation of specialized classes based on already defined (general) classes – they can share (and expand) their behavior without having to redefine it. This is usually done by grouping objects into classes and defining classes as extensions of existing classes. The concept of inheritance allows the construction of new classes that preserve the characteristics and behavior, that is, the data and membership functions, from one or more classes previously defined, called basic classes, it being possible to redefine or add new data and functions.
The idea, Object Oriented Programming (OOP) is to create programs as a collection of objects, individual code units that interact with each other instead of simple lists of instructions or procedural calls.

About the author

Ilias spiros
By Ilias spiros

Recent Posts

Archives

Categories