Re: how to mark protected properties?
| From: | Joakim Andersson | Date: | Tue, 08 Jun 2004 11:10:17 +0000 |
| Subject: | Re: how to mark protected properties? | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-30150@lists.php.net to get a copy of this message | ||
On Tue, Jun 08, 2004 at 01:15:53AM +0200, 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.
Of course you'll use a macro or an IDE which can create those methods
for you and then change the methods afterwards if necessary.
--
Joakim Andersson ; ja@morrdusk.net ; http://morrdusk.net