Re: overprotective?

From: Date: Wed, 06 Apr 2005 11:08:17 +0000
Subject: Re: overprotective?
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-37108@lists.php.net to get a copy of this message
Lukas Smith wrote:
Hi,
Hi!
While playing around a bit with php5 visibility I noticed that in PEAR we mostly mark things either private or public. However I think people (including me) just got into the habit of doing so without good reason. Marking things private implies that classes that inherite from the class do not see any of the private properties/methods of their parent. This however is rarely the intention.
Making properties protected or public is dangerous. With methods you have some control of what happens, but properties should never be touched outside the class without going through setters/getters (unless you know for a fact that people _will_ get/set them without the class knowing it and therefor can take the actions required) regards, Robin

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