Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Re: Re: Class::Interface -- isa() Considered Harmful

by perrin (Chancellor)
on Jan 16, 2003 at 19:56 UTC ( [id://227472]=note: print w/replies, xml ) Need Help??


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.

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://227472]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (7)
As of 2024-03-28 08:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found