Re: Beginner Tutorials for using CLASSES in PHP4
| From: | Nathan Nobbe | Date: | Wed, 10 Oct 2007 18:25:11 +0000 |
| Subject: | Re: Beginner Tutorials for using CLASSES in PHP4 | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263056@lists.php.net to get a copy of this message | ||
On 10/10/07, Larry Garfield <larry@garfieldtech.com> wrote:
>
>
> On Wed, 10 Oct 2007 13:39:31 -0400, "Nathan Nobbe" <quickshiftin@gmail.com>
> wrote:
>
> > The fact that you have used interfaces in that example proves nothing to
> > me.
> >> It is possible to code a solution which does not use interfaces, so
> what
> >> are
> >> the benefits of the "with interfaces" solution over the"without
> >> interfaces"
> >> solution. If there are no benefits then I prefer to stick with the
> >> "without
> >> interfaces" solution.
> >
> >
> > lets see your w/o example then.
>
>
> That it is possible to write functioning code without Interfaces has never
> been disputed.
and im not disputing it either.
> Just because you CAN use interfaces does not mean that you MUST use
> >> interfaces. I can build solutions without them, so I do not see any
> >> advantage in using them.
> >>
> >
> > i told you what the benefit is; HumanHand and Grass have no relationship
> > other than
> > they are both Cuttable.
> > the advantage to using them in this case is if Grass and HumanHand both
> > inherited from
> > the same base class they would have common member variables which makes
> no
> > sense
> > because they arent directly related.
> >
> > there are plenty of libraries that are open source and utilize
> interfaces
> > in
> > their design.
> > look at ezc, onphp and SPL for more examples.
> >
> > -nathan
>
> Multiple inheritance. If you extend a class, you can do so at most once
> for a given child class. But you can implement many interfaces.
right; thats a benefit of interfaces i mentioned yesterday, but implementors
dont get behavior from the interfaces the implement.
which is a benefit exhibited by the lawnmower example that uses interfaces.
-nathan