Re: Re: classes v. functions

From: Date: Sat, 19 Jul 2003 12:22:51 +0000
Subject: Re: Re: classes v. functions
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-155882@lists.php.net to get a copy of this message
Hi, I myself never really create classes to use in my projects, if I ever use classes its only because they come from someone else (eg phpclasses.org), I find using the non OO approach much easier to understand. Just my 2 cents. Cheers, -Ryan ----- Original Message ----- From: "Sam Baum" <idsam@gmx.de> To: <php-general@lists.php.net> Sent: Saturday, July 19, 2003 11:59 AM Subject: [PHP] Re: classes v. functions > Hi, > > am Friday 18 July 2003 23:08 schrieb Andu: > > > This may show my ignorance or my refusal to take for granted something I > > don't fully understand but I have a hard time figuring out the advantage > > of using classes as opposed to just functions. I am certainly new to php > > and at first sight classes seemed to cut a lot of corners but so do > > functions (with which I have more experience). The more I read about > > classes the deeper the confusion. Anyone can enlighten me? > > Im programming for a few years now in PHP. After trying to use classes i > dont see their point either. In most cases if i need a class-like structure > i do something like this: > > function thing_new() { > return ++$GLOBALS['thing_resource']; > } > > function thing_put($stuff, $res=NULL) { > if (is_null($res)) $res = $GLOBALS['thing_resource']; > $GLOBALS['thing_stuff'][$res] = $stuff; > } > > function thing_get($stuff, $res=NULL) { > if (is_null($res)) $res = $GLOBALS['thing_resource']; > return $GLOBALS['thing_stuff'][$res]; > } > > Because there is no constraint to be more OO like in Java it doesnt makes > sense. And this way you are more flexible. > > > bg > > Sam > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#155882) next »