What is better in performance of OOP PHP 5.3 programming?

  • Thread starter Thread starter nax151
  • Start date Start date
N

nax151

Guest
I read a lot about OOP programming, although i'm still a little bit of confused about what is better in the means of performance.

So the question is:
What should i better use for a robust php application, one big object and call to everything under it like $app->db->function(); and so on with all other objects (9 is exact number), or use many smaller classes and call to them in ways like $db->function(); $member->function etc ??
My personal benchmarks showed that the second way with many smaller classes runs a bit faster and i wanna find out if some other people get same results ...
 
Design for simplicity and correctness first, execution speed second. It's a well-known adage among computer programmers that "premature optimization is the root of all evil", which refers to exactly what you're doing here: you're optimizing for a performance hazard that may not even exist.

Build your application with the most sensible design possible. This should make your app really simple to work with, and easy to change if performance problems DO arise. If you do the reverse, and design for absolute speed first and functionality second, you're liable to end up with something that's quite fast, but impossible to work with for being too big and complex.

To actually answer your question, I have no idea, sorry.
 
Back
Top