Re: overprotective?

From: Date: Wed, 06 Apr 2005 11:36:15 +0000
Subject: Re: overprotective?
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-37110@lists.php.net to get a copy of this message
Lukas Smith wrote:
Protected properties cannot be modified from the outside either.
No, but they can be modified by a class that extends the class.
Aside from that its not really efficient to force everything through setters/getters in PHP, so I dont think we should proclaim this as evil so easily.
I don't proclaim getters/setters, I just say that using protected/public access on properties are dangerous unless the properties are treated as they could contain dangerous data from the owner of the properties.
Aside from this there is one serious drawback to labeling things with private/protected. When using __call() to dynamically add functionality through objects that are created ondemand and stored as properties you quickly run into problems. There visibility "package" would probably be wiser to use, even if its not supported in PHP5 (and therefore can only be noted via an @access phpdoc comment).
Not really sure what you mean here :) regards, Robin

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