Definition of 'class':
- a block of code that has been designed to be reused on a sistematic basis. It receives pre-defined parameters, processes them and sends back a result for those parameters. Such result may be a value, a behaviour or something else. It does not need to be OOP or Procedural and with a properly coded algorithm performance is unlikely to be an issue in both cases.
Definition of 'Object Orient Programming':
- An alternative and more recent method of writting code that consists upon building and in someway manipulating an abstraction called 'Object'. Such objects can be used in very different ways, but some people say that the real strenght of OOP is about taking the most of the capacity that makes the best developers stand out: the hability to abstract. The code becomes more readable, concepts become more clear, and everything gets more systemic. It is an alternative to the tradicional style of writting code, that we now call 'Procedural'.
I have developed lots of classes, and used a few others. For example, I have an online platform that uses an OOP class for generating PDF's. It's called FPDF and it gets used intensively 24/7. Performace has never been an issue. If fact, it never had any issue and it has proven to be a great way to generate my pdf's.
On the ohter hand, the same same platform runs intensively all the other classes that I have written in procedural style. Some of these classes run on every single script that gets called by any user. Again, performance has never been an issue.
I'm not a fan of the OOP approach. I'm doing fine with the procedural style and I'm not planning to move on.
But keep in mind that I am also very unlikely to be considered one of those that has or will ever stand out...
Manuel Lemos - 2012-03-21 23:04:04 - In reply to message 1 from Rui Cunha
PHP allows both OOP and non-OOP programming styles. You can use both and that is OK.
The point of the article is that if you want to organize better your code, avoiding global name collision and promoting reuse of code that can be useful in different projects, classes are the way to go.
If you do not need to make your code more organized or more reusable, you do not have to waste your time migrating code. To be clear, the article never said or suggested that you do that, so you are fine.