Page 1 of 1
OO or Procedural - Which one you like
Posted: Sun Nov 22, 2009 7:50 am
by anand
and why?

Re: OO or Procedural - Which one you like
Posted: Sun Nov 22, 2009 7:32 pm
by John Cartwright
Vague question much? :d
I choose OOP because I like clean, compartmentalized, modular, maintainable and testable code. Oh.. and because it sounds cooler
Seriously, are you just looking for an open ended discussion?
Re: OO or Procedural - Which one you like
Posted: Sun Nov 22, 2009 9:19 pm
by volomike
Oh, I've heard this argument before. The poster is probably referring to the fact that unless you use some extra coding, PHP doesn't easily retain objects (object persistence) between clicks like let's say a J2EE platform might do, which might hold an object in virtual memory for one entire session or simultaneously among all loaded sessions. So, to use objects adds a layer of overhead, some people think. Some may compare:
Static OOP
Code: Select all
View::addVar('items',20);
View::displayView();
to:
Instantiated Object OOP
Code: Select all
$this->view->addVar('items',20)->display();
to:
Procedural Fake OOP
Code: Select all
View_addVar('items',20);
View_displayView();
...where each are global functions.
But I tell you, there are advantages to going the non-procedural route, like, private and public properties and methods, inheritance, and so on. The overhead is so worth it.
Re: OO or Procedural - Which one you like
Posted: Mon Nov 23, 2009 11:52 am
by Jenk
I'm surprised anyone bothers replying to these threads anymore. Save for a
search link.
Re: OO or Procedural - Which one you like
Posted: Tue Nov 24, 2009 7:30 pm
by josh
you forgot an option, AOP