in reply to Re: Re: Class::Interface -- isa() Considered Harmful
in thread Class::Interface -- isa() Considered Harmful

It looks to me like you're getting things from inheritance and containers mixed together. An Airport may contain an Arcade, but it would not implement collect_quarters() any more than a Directory class would implement the methods of a File class. If you want to do something with the arcade, you qould query the Airport with a get_arcade() or something, and then operate on the returned Arcade object.

Same deal with the Car interface: $car->get_wheel->throw_hubcap(). Inheritance doesn't enter it, and neither does sharing interfaces.

  • Comment on Re: Re: Re: Class::Interface -- isa() Considered Harmful

Replies are listed 'Best First'.
Re: Re: Re: Re: Class::Interface -- isa() Considered Harmful
by castaway (Parson) on Jan 17, 2003 at 08:06 UTC
    Ah, Perrin you wrote exactly what I was just thinking.. I also can't see why an Airport should be able to directly respond to Arcade methods.. if a Person walks by, it should just do 'getArcade()->addPerson(personobj) and let the Arcade deal with it.. Absolutely no need to do anything else, in my opinion.

    C.