Is object-oriented programming in languages ​​with interpretation (i.e. PHP) effective?

I'm just wondering if it's worth sticking to non-OOP code for the sake of speed. In addition, is OOP used in commercial web applications or is it generally avoided? What standard?

Many thanks,

Ed

+6
source share
4 answers

The standard is to improve code readability through efficiency, since most of the time, “more efficient code” runs one millisecond faster. Object-oriented programming is generally more readable than a non-object-oriented analogue.

See also this question: Why are so many interpreted web languages ​​not compiled? . Most of the page load time is spent sending and receiving data or creating a database.

+9
source

OOP is commonly used in commercial webapps and is becoming the standard. The reason for this is not efficiency — it's code reuse, code readability, easy documentation, structure, and, more importantly, modularity!

+4
source

Object-oriented code is standard, but not for performance reasons. It is really about maintainability.

Code rate rarely occurs due to any real consequences in web applications. I / O is much more appropriate, and most of the optimization users are ultimately designed to reduce I / O:

  • Permanent database connection
  • Caching data fragments
  • Page Caching
  • Client Side Cache Header

Any significant CPU intensive tasks are usually handled by compiled plugins and made available to the interpreted language. Some common examples:

  • PDF Generation
  • Image Processing (Imagik, GD)
  • Cryptography (OpenSSL)
+3
source

I think OOP overhead is generally negligible for speed performance, and the code will have a lot of quality.

Commercial applications typically use OOP if they start after it has been available (and stable!)

+1
source

All Articles