Re: how to mark protected properties?
| From: | Bertrand Mansion | Date: | Mon, 07 Jun 2004 21:03:40 +0000 |
| Subject: | Re: how to mark protected properties? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-30100@lists.php.net to get a copy of this message | ||
Lukas Smith wrote:
>Martin Jansen wrote:
>> On Mon Jun 07, 2004 at 03:2800PM -0400, Daniel Convissor wrote:
>>
>>>So, should @private items be preceeded by "_", nothing, or something else?
>>
>>
>> I think protected members should be prefixed with "_" as well, because
>> they are semantically more similar to private than to public members.
>> And I also think that we should stick to this rule for PHP 5, too.
>
>+1
-1
Everything should be protected by default in OO code.
PHP makes everything public by default, that's just a design error and defeats
the whole point of data encapsulation, probably due to BC.
I won't prefix all my instance vars with _. Users are free to refer to the API
documentation.
Bertrand Mansion
Mamasam