📜 ⬆️ ⬇️

Why does everyone work with OOP? Briefly about the main or “food” for reflection

I do not know yet why and why the first post I chose this one. Yes, I understand perfectly well that from this post I will receive a lot of negative comments and maybe karma will inevitably be spoiled, but let's hope it is worth it.

What I would like to draw your attention to, that I do not want to persuade anyone or change my point of view. This post, as it sounds in the title, just make you think .

At the same time, I will prescribe some material that will allow us to exclude some of the negative that causes this post in true OOP.

All the examples and reasoning will be for small and specialized projects, some of the links will be to the resources that I did, some simply taken from the network. For those who have stopped reading the post, since he considered that I was an advertiser, alas, I could no longer convince them of this. For those who stayed, I have already moved away from the fact that the goal in life is to make money, fortunately, I have already achieved the success I wanted when I was 19 years old.
')
Let's start the topic of discussion. We will ask a few questions why and why OOP is used. From Wikipedia for those who do not know what it is, can read in detail for each item.


Let's go through each of them separately, and I will try to refute the expediency of their use.
During abstraction, the main goal is to exclude insignificant characteristics of the object from consideration. I have been programming in PHP for more than 6 years, and even with this experience I cannot choose 100% significant and insignificant characteristics, and in the process of robots I return to what I have already written, the same, I cannot use the basic principle of OOP. Of those who consider themselves to be a true OOP com, try to remember how many times you returned and edited a function in the class, and after editing which you had a bug or error in previous use.

As for encapsulation , how difficult is it to display data processing in a separate file without using classes and functions? This is not a problem even for a beginner, so I’ll stop this discussion.
As for inheritance , this is generally nonsense, since it is used during any programming. We do some actions to use the result in others. Now someone is ready to crush me and my opinions in the comments, but before you do this, try to grasp the essence of inheritance that you use in your OOP. Review the last use and re-read what I wrote. The essence remains the same?

Let's move on to polymorphism , but on the one hand it’s cool, you don’t have to be distracted by trifles, you don’t get any extra information and you can’t use it. And again, and what information is superfluous? You can hardly say with 100% certainty that one or another parameter or characteristic will not be used in the future. And then the use of polymorphism begins to require more time to use.

And I want to summarize a little bit on the PLO:



A few successful examples of how to achieve the goal without the use of the PLO, that I would not be considered "windbag"

fastchange.com.ua has a huge amount of cross-server and cross-site work in the resource itself is just a shell for the user, and a reporting generator for the owner, using OOP only from the Yandex API, development time is 4.5 hours .

watchcases.ru, magniflex.ru/shop/, xpectik.com.ua used to stand on the OsCommerce system, which is “imbued with” OOP, now on the system I developed, without a single OOP element, the download speed of the site increased from 1200% to 3600%, the first development of 16-17 hours , followed by up to 6.5 hours .

Well, if you want to spend your time in order to be considered as the PLO of the PLO, the choice is yours.
Post is not directed to those who write resources with more than 400-600kb. manual code.

Source: https://habr.com/ru/post/148088/


All Articles