Re: On private vars, inheritance and API design
| From: | Lukas Smith | Date: | Sat, 09 Oct 2004 14:22:30 +0000 |
| Subject: | Re: On private vars, inheritance and API design | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-33736@lists.php.net to get a copy of this message | ||
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? regards, Lukas