OO or Procedural - Which one you like

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
anand
Forum Commoner
Posts: 80
Joined: Fri May 22, 2009 11:07 am
Location: India
Contact:

OO or Procedural - Which one you like

Post by anand »

and why? :mrgreen:
User avatar
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

Post 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 8)

Seriously, are you just looking for an open ended discussion?
User avatar
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

Post 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.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Re: OO or Procedural - Which one you like

Post by Jenk »

I'm surprised anyone bothers replying to these threads anymore. Save for a search link.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: OO or Procedural - Which one you like

Post by josh »

you forgot an option, AOP
Post Reply