Re: how to mark protected properties?
| From: | Bertrand Mansion | Date: | Tue, 08 Jun 2004 08:40:30 +0000 |
| Subject: | Re: how to mark protected properties? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-30138@lists.php.net to get a copy of this message | ||
Tomas V.V.Cox wrote:
>Bertrand Mansion wrote:
>>
>> 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.
>
>IMHO, as silly as sounds to prefix all vars with '_', sounds to create
>dozen methods/calls for getting access to those protected vars.
If you are clever, all you need is 2 methods.
That's called key-value coding.
Bertrand Mansion
Mamasam