Computers, Programming
Basic principles of OOP and their use
general information
OOP is a programming style that appeared in the 80s of the 20th century. Unlike procedural languages, where data and instructions for their processing exist separately, in object-oriented programming this information is combined into a single entity.
Basic principles of OOP
Object-program programming has its own postulates. The principles of the PLO are his basic ideas. There are three most important of them: inheritance, polymorphism and encapsulation. Below, each will be discussed in more detail. The basics of programming in OOP languages consist in the use of objects and classes. When moving from the procedural style of writing source code to object-oriented, there are often difficulties, 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-class. While writing programs in one of the OOP languages, a distinction is made between information inside the entity and outside. Thus, it is possible to ensure the security of data and methods of their implementation from external influences, for example, from other classes that are not related to this object. Inside the entity, the 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 the other without repeating their actual implementation. Inheritance allows you to get rid of the redundancy of the source code.
Polymorphism
Another principle of OOP is polymorphism. Its use means that to manipulate objects of varying complexity, you can create one interface that will react differently to events and simultaneously correctly implement the tasks.
OOP Languages
The principles of OOP are used in such popular programming languages as C ++ and Java, on which a significant number of programs and applications are developed. There are also less used OOP languages - Delphi, Object Pascal, Ruby and many others.
Criticism of the PLO
Despite mostly positive statements towards this methodology, OOP principles are often criticized. Like procedural programming, OOP has its drawbacks.
First, the complexity of the transition. To understand the principles of OOP, it will take quite a lot of time, especially for people who work closely only with procedural programming languages.
Third, excessive universality of methods can lead to the fact that the source code and developed programs will be overloaded with functions and capabilities that are not required in this particular case. In addition, note the 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 developing rapidly.
Similar articles
Trending Now