Develop PHP

Object Oriented Programming (OOP) : as it applies to web development technology

Object Oriented Programming(OOP) is the act of producing modular reusable code for extensibility purposes. OOP works by loading class files and packages that can be easily tapped into in your normal procedural scripting. OOP is applied when the programmer has a complex application and requires all code to be modular, easy to find, easy to adjust, and easy to share. However, OOP is not the only way to make your applications smart and externalize your code.

Object Oriented Programming does not make your code better, or make your applications run faster. On the contrary, Procedural code operates faster than OOP due to being less bytes of code to accomplish the same task and no external files need be called on creating extra requests that cost the server resources. A programmer applies OOP to their applications when the application complexity or workflow calls for it. To apply OOP where it is not required or called for is not a good practice in programming. Procedural code should always be applied if modularity is not a specification of the application you are creating.

If you have the same lines of code that may run in multiple places in your application, you may want to apply OOP or external code inclusion methods such as this PHP tutorial demonstrates. This way you can bypass writing the same function over and over again on each document it is needed in. If you plan for the application to be worked on by other people taught to OOP, you may want to OOP at that point. If your application is huge and bulky with code to the point of confusion, that is a good time to OOP. If you do not have any of those needs, then you have no reason to apply OOP other than to be extra geeky for no good reason and overcomplicating your application.

It is also important to note that many modern programming languages have code or file inclusion methods which allow you to externalize your code making it modular, easy to share and work on, extensible, etc... Having the same properties of OOP for most reasons OOP is applied. Think of it as "Procedural Modularity" when you use code inclusion as opposed to OOP.

To prove to yourself whether OOP programming, or Procedural programming runs faster simply time your application execution to the millisecond, and also evaluate how much server resources are used to run each in comparison.