Re: [PHP] PHP5 and the DOM model
- Date: Fri, 18 Apr 2008 13:54:58 -0600
- From: "Nathan Nobbe" <quickshiftin@xxxxxxxxx>
- Subject: Re: [PHP] PHP5 and the DOM model
On Fri, Apr 18, 2008 at 1:42 PM, Robert Cummings <robert@xxxxxxxxxxxxx>
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