Object-oriented programming
Miscellanea / / July 04, 2021
By Guillem Alsina González, in Oct. 2017
In addition to languages of programming, there are different ways or philosophies of approaching the design of a program of software, forms that are reflected in the different languages, which embrace them to satisfy the requirements of a certain type of tasks or of a group of programmers. One of these philosophies is object orientation.
Object-oriented programming consists of considering as "objects" the subjects of interest of the program, each type of different element is defined with its data and the treatment methods of these.
This allows, basically, treating these objects as one more data type, on which to apply methods and create constructions that will perform calculations and manipulations. These new data types are built from the basic types that the programming language includes, and the operations are declared as procedures or functions.
A notable feature that allows this development model is the so-called "inheritance", which consists of creating new objects from the previous ones, modifying or expanding both their attributes and the methods to be exercised on they.
Although object-oriented programming has been gaining popularity in the world of programming since the late the decade of the 80s and the beginning of the 90s, the truth is that its creation goes back much further, at the end of the years 60.
The trigger for the success of object-oriented programming was, to a large extent, the popularization of graphical user environments such as Windows, since the paradigm greatly facilitates the creation of resources graphics, derive them in other similar resources (through the aforementioned inheritance), and work with methods that respond to user actions on elements.
From here, it became the dominant paradigm, being the one used by a greater number of languages, and the most successful among programmers, a situation that has lasted until today.
The different types of object must be declared as a class at an initial point in the program before being able to instantiate objects that belong to that class.
In this way, the program is structured in an understandable way for someone who examines it from the outside, by following a logical sequence.
To make these concepts understandable, let's take an example: a program of administration of personnel in a company.
A class could be that of worker, with attributes such as name, surname, number of the social Security, position, salary, etc. Each instantiated object would be a different worker. For example, we could create a list for each department, or a global list of workers, depending on the way of managing and think the program.
The methods to be applied to this class could be several, such as "salary increase", which would multiply the salary by a certain percentage, or assign vacation days, which would insert vacation marks in each worker's calendar, which will differ between workers in order to enjoy shifts.
This class could give rise, through inheritance, to a new class called "scholarship holders", which did not have an attribute such as salary, but one or more related to training, since the status The legal requirements of the interns could oblige the company to train them.
Over the years, many programming languages have emerged that openly embrace the object-oriented paradigm as a way of working.
The best-known language is perhaps C ++, which gives traditional C an object-oriented patina.
However, there are other languages, also well known, that follow the same object-oriented paradigm, such as Java, Visual Basic .NET (developed by Microsoft), Objective-C (used mainly in Apple systems), and languages widely used in Internet applications such as Ruby, Python, Perl or PHP.
Photo: Fotolia - RMS164 / Sentavio
Topics in Object Oriented Programming