Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^4: OO design: abstract class or can()?

by adrianh (Chancellor)
on Mar 24, 2007 at 20:52 UTC ( #606432=note: print w/replies, xml ) Need Help??

in reply to Re^3: OO design: abstract class or can()?
in thread OO design: abstract class or can()?

It's also a nice bit of future-proofing in case Perl ever gets multi-dispatch... and that day may be closer than many people think. (I mean dispatch based on role, not structural type.)

Meh. Still think it would be simpler without the "if". Spinning out the calling behaviour from the thing being called feels odd to me.

If the calling is independent of the class then something AOPish would seem appropriate. If not then having e the base class have that trait with a null method rather than have a condition on something that may not be present seems cleaner to me.

  • Comment on Re^4: OO design: abstract class or can()?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://606432]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2018-06-20 18:18 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (117 votes). Check out past polls.