Re: PHP5 and the DOM model
| From: | Nathan Nobbe | Date: | Fri, 18 Apr 2008 19:54:58 +0000 |
| Subject: | Re: PHP5 and the DOM model | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-273279@lists.php.net to get a copy of this message | ||
On Fri, Apr 18, 2008 at 1:42 PM, Robert Cummings <robert@interjinn.com>
wrote:
> Nope, the point is moot. If I've made my properties publicly accessible,
> now, due to the ability to trap via __get() or __set(), I can remove
> them and handle them. Thus, I can retrospectively change the semantics
> without care for having exposed the properties themselves. The point is
> moot here because the option now exists to enhance properties at a later
> date without the need to drive the enhancements through a method the
> user must call (the details of __get() and __set() are hidden from the
> user of the properties ;)
i see your rationale now, and yes i agree, using the magic methods does
afford the ability to make transparent changes and thats great. however,
what im saying is thats still encapsulation, just a different way of
attaining it. and the other negative of that approach is having to bulk up
the logic in the magic methods. i tend to use them to handle attempts to
access non-existent params.
actually, tho drifting a bit; i think the __call() magic method is great
because it allows handling of what would otherwise be a fatal error when
trying to invoke a non-existent class method.
-nathan