RE: [PHP] Class Design Question...

From: Date: Wed, 06 Aug 2003 17:18:10 +0000
Subject: RE: [PHP] Class Design Question...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-158518@lists.php.net to get a copy of this message
Hi, Are there any performance differences that are noticable in a 300-400 line PHP script if you overuse classes rather than straight functions? -Dan Joseph > -----Original Message----- > From: Chris W. Parker [mailto:cparker@swatgear.com] > Sent: Wednesday, August 06, 2003 1:02 PM > To: anachronism@mengelt.com; php-general@lists.php.net > Subject: RE: [PHP] Class Design Question... > > > anachronism@mengelt.com <mailto:anachronism@mengelt.com> > on Wednesday, August 06, 2003 9:34 AM said: > > > I'm rewriting a lot of code and have decided to use classes... I'm > > wondering if this would be considered bad design or not... > [snip] > > /Sounds/ like a good idea. Are you really going to end up with an array > of errors? Wouldn't you normally stop operation on the first error? Or > at the very least report back to the user on the first error*? > > Maybe you could do something like this... > > function doYourThing($this) > { > if(!empty($this)) > { > if($this == $that) > { > // do this stuff > } > else > { > // do this instead > } > } > else > { > return error(400); > } > } > > error($err) > { > switch ($err) > { > case 100: > $error = "you suck!"; > break; > case 200: > $error = "jo mama!"; > break; > ... > case 400: > $error = "var empty"; > break; > } > > return $error; > } > > > Pretty close to what you were going to do, just slightly different. > > > hth, > chris. > > * By error I mean something catastrophic like someone messing with the > values in the querystring or a variable containing data you were not > expecting. I don't mean someone forgot to fill in their last name on > your registration form. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#158518) next »