Re: new phpruntests and the use of private
| From: | Lukas Kahwe Smith | Date: | Wed, 22 Jul 2009 20:51:48 +0000 |
| Subject: | Re: new phpruntests and the use of private | ||
| References: | 1 | Groups: | php.qa |
| Request: | Send a blank email to php-qa+get-65237@lists.php.net to get a copy of this message | ||
On 22.07.2009, at 22:37, Greg Beaver wrote:
Hi, I'd like to formally suggest that private not be used in the source code of phpruntests, and protected be the exclusive encapsulation PPP thing used. Why? In my limited experimentation with extending the --FILE-- handler to function differently, it was impossible to do without cut/pasting some code in private blocks into a new subclass. The use of "private" on variables and methods severely limits its future flexibility, and using "protected" would not reduce any of the benefits gained by encapsulation. This one is pretty easy to do, just s/ private / protected /I agree .. imho PHP should never have even supported private. I would turn it around though, anything that should be be public, should default to protected. Use private only if you can make the case for it .. and then its your obligation to properly document the reasons in a sufficiently verbose comment. That should be in the CS of any project developing PHP code. regards, Lukas Kahwe Smith mls@pooteeweet.org