Did you understand what I said about why you wouldn't put magic
methods in the interface?
Yes, and I agree with you. I was just stating that it would be unsafe to use magic methods at all since they cannot (or should not) be in the interface.
I'm curious, what would be the point of using an interface and an abstract base class? Shouldn't all of the derived classes implement the interface, instead of extending a base class? Or if all derived classes extend the base class, then what is the point of the interface?
Also, if there are going to be two or more abstract classes (each implementing the interface), how can we guarantee that they all have magic methods that behave similarly?
It seems that there are two design approaches; one using interfaces with no magic methods (including concrete implementations) and another using abstract classes with the possibility of magic methods, but no interface.
Does this sound right?
-Hector
On Thu, Jun 4, 2009 at 3:38 PM, Ed Lazor <edlazor@internetarchitects.biz> wrote:
On Thu, Jun 4, 2009 at 3:20 PM, Hector Virgen<djvirgen@gmail.com> wrote:You put the magic methods in a basic model class and then extend
> I understand the benefits of magic methods, but how will I know if my object
> even has them (or which properties can be set) if it's not in the interface?
everything from there.
Did you understand what I said about why you wouldn't put magic
methods in the interface?
-Ed
没有评论:
发表评论