Why turn absolutely everything into Classes in PHP?

2
My systems in both ASP, Delphi and PHP maintains an old (procedural) middle pattern in programming mode, as I find it tedious to program the way it is today, I see many, if not all, using Classes, Objects and the like in such simple routines and make maintenance a burden at least for me, I know that it is best to follow the market so as not to be behind, and I am doing this by trying to understand better about classes and their allies, rs, I now use PHP Templates and Inheritance Delphi and I try to separate the routines and common functions in Units, leaving the code as readable as possible.

Of course I use some classes, even third-parties that make life easier, I confess that I do not try to understand what the user wanted to do, but rather if it works because my time is very scarce.

But as I delved into web classes, I saw that some like me are reluctant to make use of 100% of classes, leaving only cases where the code gets huge in a routine.

Netbeans for example suggests that a function has no more than 20 rows, I'm far from reaching any degree of a Netbeans programmer, but I wonder if I break down my functions every 20 rows my files will get very fragmented , and reading those will be awful.

I will try not to take sides on whether it is good or not, I have read that classes are slower than procedural (I found it strange), in turn I have seen which class is widely used, this in itself already shows that it can be better .

In my comparisons I have not been able to see the real advantage of using classes in not-so-complex systems, I have seen that many programmers use class for example in a simple Insert, Select, Delete, making a simple execution in a tangle of codes, where a simple function would solve the problem.

I will take PHP as an example, I know that many internal functions make use of classes, but to use them do I really need to make use of them too?

The use of classes would not be to organize the code, would not it be better to leave the use of classes to create objects, for example connection, or some complex calculation, as they are done with various DLLs and Components in Delphi and others?

I am honestly and honestly wanting to be convinced that I should make constant use of classes as well as I have seen in the PHP codes I have caught.

Look, I'm just studying classes and I hope to understand and make good use of them, do not understand this post as a criticism but rather as a discussion that can pay good results both to me and to those who read.     

asked by anonymous 27.03.2018 / 03:11

0 answers