general information
OOP is a programming style that appeared in the 80s of the 20th century. Unlike procedural languages, where data and instructions for processing them exist separately, in object-oriented programming this information is combined into a single entity.
Basic principles of OOP
Object-programming programming has its own postulates. The principles of OOP are its main ideas. There are three most important of them: inheritance, polymorphism and encapsulation. Each will be discussed in more detail below. The basics of programming in OOP languages are to use objects and classes. When switching from a procedural style of writing source code to object-oriented, difficulties often arise, but most developers find many advantages in OOP.
Encapsulation
Encapsulation is the use of combining data and instructions for processing them into a single entity - a class. When writing programs in one of the OOP languages, a distinction is made between information inside the entity and outside. This ensures the security of data and methods for their implementation from external influences, for example, from other classes that are not related to this object. Inside the entity, data successfully interacts with each other, but is reliably protected from unauthorized access from the outside.
Inheritance
The second principle of OOP - inheritance - is the ability of one class to use the methods of another without repeating their actual implementation. Inheritance eliminates redundancy in source code.
Polymorphism
Another OOP principle is polymorphism. Its use means that to manipulate objects of varying degrees of complexity, you can create one interface that will respond differently to events and at the same time correctly implement the tasks.
OOP languages
OOP principles are used in the most popular programming languages such as C ++ and Java, which have developed a significant part of programs and applications. There are also less used OOP languages - these are Delphi, Object Pascal, Ruby and many others.
OOP criticism
Despite mostly positive statements in favor of this methodology, the principles of OOP are often criticized. Like procedural programming, OOP has its drawbacks.
Firstly, the complexity of the transition. To understand the principles of OOP, it will take a lot of time, especially for people who work closely only with procedural programming languages.
Secondly, the disadvantage is more complex documentation, since it will be necessary not only to describe classes and objects, but also specific cases of their implementation.
Thirdly, excessive universality of methods can lead to the fact that the source code and developed programs will be overloaded with unclaimed functions and capabilities in this particular case. In addition, they note inefficiency in terms of memory allocation. However, regardless of the opinions of others, the number of OOP programmers is constantly growing, and the languages themselves are rapidly developing.