Is object-oriented PHP slow?

前端 未结 11 1903
温柔的废话
温柔的废话 2020-12-15 06:24

I used to use procedural-style PHP. Later, I used to create some classes. Later, I learned Zend Framework and started to program in OOP style. Now my programs are based on m

11条回答
  •  [愿得一人]
    2020-12-15 06:44

    This bugs me. See...procedural code is not always spaghetti code, yet the OOP fanboys always presume that it is. I've written several procedural based web apps as well as an IRC services daemon in PHP. Amazingly, it seems to outperform most of the other ones that are out there and editing it is super easy. One of my friends who generally does OOP took a look at it and said "no code has the right to be this clean"

    Conversely, I wrote my own PHP framework (out of boredom) and it was done in a purely OOP manner.

    A good programmer can write great procedural code without the overhead classes bring. A bad programmer who uses OOP will always write crappy OOP code that slows things down.

    There is no one right answer to which is better for PHP, but rather which is better for the exact scenario.

提交回复
热议问题