OOP PHP Inefficient?

Possibly. But not all procedural code is bad and not all object orientated code is good.

Stating OOP > procedural programming is a gross oversimplification of the whole issue.

Of course it would. Have you never heard of CGI? Heck you could write a web application in assembly if you were crazy enough.

It is easy to theorize about these things but in the end it depends on this: is it practical or not.

to continue with analogies it is like saying that since a Ferrari is fast it can save you much more time in a highway than a regular car. In theory, yes. Or saying “yeah! I can modify my car and compete in a F1 circuit” yeah… maybe… but what’s the point? is it worth the effort? Comparing raw speed against nothing is always a win.

When people claims that C++ should be used in sites like Facebook… really? don’t you think someone would have already tried it? speed is is important but is not the only thing to consider in a project… same for OOP.

Small medium systems may not need full OOP capabilities… bigger systems yes, maybe… it depends. Frameworks in the other hand provide a base platform but you are always conditioned by the framework’s structure. There is no universal solution.

That is a very good point.

Just look at Linux (an an operating system, not just the kernel), the vast majority of that is written entirely in procedural C code. It works well because the design is good.

Another important aspect is that it is perfectly possible to write object orientated code in procedural languages. It is quite common to see object orientated C programs (note: not C++). Just take a look at GLib.

Much of this discussion has been mis-focused on OOP as the villain. I didn’t say OOP is the problem. I said the combination of three techniques combined at launch time is not efficient. Haiping Zhao of Facebook found this same inefficiency and compiled PHP it into C++. That’s a solution!

But, the fact that #2 Web site that depends on PHP developers decided to go with the economic model found a need to decrease PHP’s inherent inefficiency closed this thread, I think.

PHP is not for big sites like Facebook.

PHP is not for big sites like Facebook.

Time will tell.

Time has told. FaceBook are using HipHop to compile their PHP code into C++ code instead.