Re: Re: On private vars, inheritance and API design

From: Date: Sun, 10 Oct 2004 21:37:49 +0000
Subject: Re: Re: On private vars, inheritance and API design
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-33756@lists.php.net to get a copy of this message
On Sat, Oct 09, 2004 at 04:22:30PM +0200, Lukas Smith wrote: > Stefan Walk wrote: > > > 1. Violating the "private" character of methods/properties > > > >It seems to be quite common to access private methods and properties in > >non-private context. A "pcregrep -ril '(?<!this)->_' * | grep -v > >test" in > >the > >pear directory listed 172 files - I know this catches some false positives > >too, so don't take the number as accurate. It's just there to show that it > >isn't an isolated case. > > I am probably guilty for a number of those in MDB/MDB2 (dont know for > sure this very second though). In those packages I load code on demand. > Due to the absence of multiple inheritance and the lack of aggregation > this was the besr I could do to make the code size loaded more in line > with the functionality actually needed. > > Anyways as a result I have objects as properties of the relevant > MDB/MDB2 driver instances that for all intents an purposes would be > inside the driver class if it werent for the reasons stated above. > Therefore I probably accessed private methods and properties of the > driver or module instance from the module or driver. > > While this isnt clean, it seems like a valid violation. Or am I mistaken? Well... why do those methods have to be private in the first place? I scanned only quickly over the sources, and i saw no apparent reason for it... Btw, there seems to be a small error in peardb_wrapper.php - if i'm not mistaken there's a ->MDB_object missing in the first line of the quoteString method. > > regards, > Lukas > > -- > PEAR Development Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Regards, Stefan Walk <swalk@prp.physik.tu-darmstadt.de>

« previous php.pear.dev (#33756) next »