A
A
Anton2015-01-11 23:36:23
PHP
Anton, 2015-01-11 23:36:23

In what cases without OOP in PHP is it really "painful"?

To whom it is not difficult, please describe real life examples when OOP is a must have, and not a cool toy.
I figured out how it works, but I can’t put it into practice yet (even play around to fix the result).
Tell me what to program to feel all the power?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
R
Rishat Kadyrov, 2015-01-12
@laska

Why did you decide that without OOP it would be really painful? There are a lot of projects with almost no OOP. And these are not necessarily shit-frameworks, but, for example, the Linux or WinNT kernel (there is almost always pure C or assembler). These are certainly not new examples, but these are successful projects.
OOP is just a lot of syntax sugar that can make your life easier. Or maybe not easy. If you stupidly add the word "class" at the beginning of each file, then the code will formally become object-oriented. But in practice it won't.
But I don't seem to have answered your question at all. I can say this. Write more code. Try to use OOP. Sooner or later, while reading some article, you will find that you invented encapsulation in a previous project. Just do it through the back seat, and you don't know what it's called. And you will do it better. Then invent inheritance. Then polymorphism. And then you will learn the zen of OOP.

M
MintTea, 2015-01-11
@MintTea

1) Do something using a normal OOP framework
2) Do something using a procedural shit framework
3) Feel the difference and feel the power

I
IceJOKER, 2015-01-11
@IceJOKER

As suggested by MintTea, try using some OOP framework (I personally prefer yii and laravel), build some site on them, and over time, I think you will understand what advantages OOP has.
I myself initially couldn’t figure it all out (I thought what the hell is encapsulation, polymorphism and why is it necessary), but with experience I realized all the advantages (I’m lying, not EVERYTHING, I still don’t have enough experience :D) and now I can’t imagine my coding without OOP

S
Stanislav, 2015-01-12
@mzcoding

If you take exactly PHP - Then perhaps without objects and the correct architecture for building an application, it can become quite painful for a medium / large project.
As previously recommended, use some kind of laravel / yii framework. Build
some kind of cms yourself on ready-made components. Then write your bike.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question