OO or Procedural - Which one you like
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: OO or Procedural - Which one you like
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?
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?
- volomike
- Forum Regular
- Posts: 633
- Joined: Wed Jan 16, 2008 9:04 am
- Location: Myrtle Beach, South Carolina, USA
Re: OO or Procedural - Which one you like
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
to:
Instantiated Object OOP
to:
Procedural Fake OOP
...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.
Static OOP
Code: Select all
View::addVar('items',20);
View::displayView();Instantiated Object OOP
Code: Select all
$this->view->addVar('items',20)->display();Procedural Fake OOP
Code: Select all
View_addVar('items',20);
View_displayView();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
I'm surprised anyone bothers replying to these threads anymore. Save for a search link.
Re: OO or Procedural - Which one you like
you forgot an option, AOP